------解决方案-------------------- SELECT * FROM TEST A
WHERE B LIKE '00%'
AND NOT EXISTS (
SELECT 1
FROM TEST B
WHERE B.A = A.A
AND NOT (B.B LIKE '00%')
)
逻辑是一样的
------解决方案--------------------
SELECT * FROM TEST
WHERE B LIKE '00%'
AND A NOT IN (SELECT A FROM TEST WHERE B NOT LIKE '00%')
------解决方案-------------------- select a,b from test where B like '00%'
and test.a not in(
select a from (
select a,b from test
except
select a,b from test where B like '00%')tb1
)
select * from test where A IN (
select A from test where left(b,2)='00' group by A having count(*)>1)
不知道符合楼主的意思不 ------解决方案-------------------- select * from test where A in
(select A from test where b link '00%'
group by a
having count(*)>1
) ------解决方案--------------------