0

I have a database with orign_ip, destination_ip, and other columns. I am looking for a way to get in SQL just the connections between two IP's, I need to get just the list. This is my first step :

SELECT DISTINCT orig_h , resp_h from gustavo.conn;
 - 15.214.135.70                15.214.159.100
 - 15.214.136.45                15.214.137.70

But How I can get from this result the just the rows that match with

15.214.135.70               15.214.159.100 
  • If there was a row with orig_h = 15.214.159.100 and resp_h = 15.214.135.70 would you want to see that as well? – a_horse_with_no_name Aug 21 at 11:44
0

SELECT DISTINCT orig_h , resp_h from gustavo.conn WHERE orig_h = '15.214.135.70' AND resp_h = '15.214.159.100'

  • Thank you . But in case Do I need to store the result of the first query in a temp table and do this thing for all the pairs ? One by one . – grojas123 Aug 21 at 0:01
  • I am looking some way to collect all the connections in one query . I am looking to create some temporary table . What you think ? – grojas123 Aug 21 at 0:03
  • @grojas123: given your sample data, this is the best answer you can get. – a_horse_with_no_name Aug 21 at 11:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.