I have a table with uuid and system column. I need a query to return only uuid's having system=1 but not the uuids with system= 1 and 2
views:
22answers:
1
+1
A:
SELECT *
FROM mytable m
WHERE system = 1
AND NOT EXISTS
(
SELECT NULL
FROM mytable mi
WHERE mi.uuid = m.uuid
AND mi.system = 2
)
Quassnoi
2010-09-17 00:11:37
+1: This more clean to my thorough approach
OMG Ponies
2010-09-17 00:19:13
The case is just an example. I will have more system types not just 1 and 2. Also I need a way to find uuid with say 1,2,3 and 3,4,5, 3 being the common value
2010-09-17 00:57:31