Hai folks,
table1
empno|salary
-------------
10 | 1500
20 | 2750
21 | 4000
table2
empno|department
-------------
19 | a
24 | b
31 | x
i want a query to get the total records in both tables.
so the result should be 6 records.
my try :
shows incorect row countCode:$query="SELECT COUNT(empno) as tot FROM table1 UNION ALL // and tried with UNION too SELECT COUNT(empno) as tot FROM table2"; if ($result=mysql_query($query) or die (mysql_error())); $row=mysql_fetch_array($result); echo "<br>" . $row['tot'];![]()



Reply With Quote



Bookmarks