如何从一张表中搜索异常数据?
有几张数据表label1,有a、b、c、d、e、f这6个字段,想从其中的b、c、d、e四个字段的值中找出大于1000的,语句该如何写?
select * from label1
where a>1000 or b>1000 or c>1000 or d>1000 or e>1000 or f>1000
-
SQL code
select * from label1 where b > 1000 or c > 1000 or d > 1000 or e > 1000 UNION ALL select * from label2 where b > 1000 or c > 1000 or d > 1000 or e > 1000 UNION ALL select * from label2 where b > 1000 or c > 1000 or d > 1000 or e > 1000
-
SQL code
SELECT * FROM lable1 WHERE a>1000 or b>1000 OR c>1000 OR d>1000 OR e>1000 OR f>1000;
详细说明,是同一服务器中?
select * from label1
where b>1000 or c>1000 or d>1000 or e>1000 or f>1000
探讨
SQL code
select * from label1
where b > 1000 or c > 1000 or d > 1000 or e > 1000
UNION ALL
select * from label2
where b > 1000 or c > 1000 or d > 1000 or e > 1000
UNION ALL
select * from labe……
-
SQL code
SELECT * FROM lable1 WHERE b>1000 OR c>1000 OR d>1000 OR e>1000;