开发者

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

开发者 https://www.devze.com 2023-01-16 23:54 出处:网络
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 2SELECT*

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
        )
0

精彩评论

暂无评论...
验证码 换一张
取 消