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;

But How I can get from this result the just the rows that match with      
  • If there was a row with orig_h = and resp_h = would you want to see that as well? – a_horse_with_no_name Aug 21 at 11:44

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

  • 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.