All, my heads hurting at this one today so I need a bit of help. I have a table with the following data;
[tt]
key val
----------
a 100
a 200
a 300
b 200
c 200
c 300
[/tt]
I want to find all keys which have a val of both 200 and 300, and just cannot find a way. I've tried this ...
which will return keys a,b,c. What I need is a way to join the 2 result sets, only including rows present in both sets.
Any ideas much appreciated. I'm running Sybase ASE 11.5.
Greg.
[tt]
key val
----------
a 100
a 200
a 300
b 200
c 200
c 300
[/tt]
I want to find all keys which have a val of both 200 and 300, and just cannot find a way. I've tried this ...
Code:
select key from table where val=200
union
select key from table where val=300
Any ideas much appreciated. I'm running Sybase ASE 11.5.
Greg.