php - How to count all records from selected table with empty fields -
assuming have four tables have select 3 tables database named records
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| |
so have 6 rows empty tables. want display sum 6 using php. thank you. comments/answers/suggestions highly appreciated.
please try this
select (select count(*) cases year = '' or natureofcase = '') + (select count(*) ballistics year ='' or name='' or type='') + (select count(*) chem year='' or identified='') total_empty
Comments
Post a Comment