ms access - selecting distinct pairs of values in SQL -
i have access 2010 database stores ip addresses of source , destination machines. if have following entries in database
|source | destination| |--------------------------------| | | b | | b | | | | b | | c | d | | d | d |
is there query select unique pairs? is, output of query should be
|source | destination| |----------------------------------| | | b | | c | d |
your question seems imply 2 things:
when listing source/destination pairs want see pairs in 1 direction, e.g., (a,b) not (b,a).
the list should omit pairs source , destnation same, e.g., (d,d)
in case query...
select distinct source, destination ( select source, destination sometable union select destination, source sometable ) source < destination
...when run against [sometable] containing...
source destination ------ ----------- b b b c d d d e d
...will produce:
source destination ------ ----------- b c d d e
Comments
Post a Comment