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 nad 2
I have a table with uui开发者_运维知识库d and system column. I need a query to return only uuid's having system=1 but not the uuids with system= 1 and 2
SELECT *
FROM mytable m
WHERE system = 1
AND NOT EXISTS
(
SELECT NULL
FROM mytable mi
WHERE mi.uuid = m.uuid
AND mi.system = 2
)
精彩评论