我有一個包含兩個表的數據庫,我想通過一個查詢獲取這些表中的行數總和。 到目前爲止牛逼嘗試:如何使用一個查詢獲取數據庫上的總行數
SELECT (count(bill.*) + count(items.*)) as TTL FROM bill, items // Failed
SELECT count(*) as TTL FROM bill, items // wrong total
SELECT (count(bill.ID_B) + count(items.ID_I)) as TTL FROM bill, items // wrong total
SELECT count(bill.ID_B + items.ID_I) as TTL FROM bill, items // return the biggest total
http://stackoverflow.com/questions/606234/select-count-from-multiple-tables –