Hi, In my php script i am running a sql statement, I am using a union statement via a count to get the number of records from 5 differient tables with the cno=3, its working fine except for one thing, if the any one of the tables dont have cno=3 it does not give me back a zero. Heres what i am doing: $theResult="SELECT COUNT(*) FROM table1 WHERE cno = 3 UNION SELECT COUNT(*) FROM table2 WHERE cno = 3 UNION SELECT COUNT(*) FROM table3 WHERE cno = 3 UNION SELECT COUNT(*) FROM table4 WHERE cno = 3 UNION SELECT COUNT(*) FROM table5 WHERE cno = 3";
this will return 5 rows in result, f.e.: COUNT(*) -------- 12 10 9 23 7 but if table1 didnt have cno=3 it gives me: COUNT(*) -------- 10 9 23 7 I am sure this must have been a problem with you guys to so how did you solve it? how can i know (in my script) if its contains a positive number or is 0? I can run 5 counts but that would be a waste of connections if the site gets a lot of members (which by the looks of it, it will). Any help appreciated, thanks in advance. Cheers, -Ryan We will slaughter you all! - The Iraqi (Dis)information ministers site http://MrSahaf.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php