日期:2014-05-20 浏览次数:20765 次
select t.name from tb1 t group by t.name having(sum(t.status1) = 0 and sum(t.status2) = 0 and sum(t.status3) = 0);
------解决方案--------------------
[code=SQL][/code]select * from t1 a where a.name
not in (select name from t1 where stu1<>0 or stu2<>0 or stu3<>0)
------解决方案--------------------
SELECT DISTINCT name
FROM test1 t1
WHERE NOT EXISTS(
SELECT *
FROM test1 t2
WHERE t1.name = t2.name
AND (t2.status1 = 1 OR t2.status2 = 1 OR t2.status3 = 1))
------解决方案--------------------
select a.* from yourtable a where not exists (select 1 from yourtable where name = a.name and (status1 = 1 or status2 = 1 or status3 = 1) )