假设我有四个表,我必须只选择 3 表,其数据库名为记录
Records
1.Cases
2.Ballistics
3.Chem
4.Accounts
Cases
id|year|Natureofcase |
0 | |Repact 1901a |
1 |2003|Repact 1907b |
3 |2004|Repact 1902 |
Ballistics
id|year|Name |Type |
0 |2003| |a-101 |
1 | |Silver-A |a-202 |
3 |2005|Red Cap | |
Chem
id|year|Identified |
0 | |H20+C20 |
1 |2001|Am |
3 |2009| |
所以我们有 6 行和空表。 我希望使用PHP显示总和 6 。谢谢。任何意见/答案/建议将受到高度赞赏。
答案 0 :(得分:1)
请试试这个
SELECT
(SELECT COUNT(*) FROM Cases WHERE year = '' OR Natureofcase = '') +
(SELECT COUNT(*) FROM Ballistics WHERE year ='' OR Name='' OR Type='') +
(SELECT COUNT(*) FROM Chem WHERE year='' OR Identified='')
AS total_empty