Query results with no reverse

Posted by gruber on Stack Overflow See other posts from Stack Overflow or by gruber
Published on 2011-01-02T20:49:37Z Indexed on 2011/01/02 20:53 UTC
Read the original article Hit count: 233

Filed under:
|

Hi,

Ive got table: UserA, UserB, numberOfConnections

I would like to write query which returns me only rows that has no reverse I mean or example : for data :

1 2 10
1 3 10
1 5 10
1 6 10
2 6 10
2 5 10
5 1 10
5 2 10
3 1 10

it should return

1 2 10
1 3 10
1 5 10
1 6 10
2 6 10
2 5 10

rows:

5 1 10
5 2 10
3 1 10

arent valid because there are already corresponding

1 5 10
2 5 10
3 1 10

thanks for help bye

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server-2008