如何從MySQL中的多個表中選擇COUNT(*)?MySQL中多個表的COUNT(*)
如:
SELECT COUNT(*) AS table1Count FROM table1 WHERE someCondition
JOIN??
SELECT COUNT(*) AS table2Count FROM table2 WHERE someCondition
CROSS JOIN? subqueries?
SELECT COUNT(*) AS table3Count FROM table3 WHERE someCondition
編輯:
的目標是回到這樣的:
+-------------+-------------+-------------+
| table1Count | table2Count | table3Count |
+-------------+-------------+-------------+
| 14 | 27 | 0 |
+-------------+-------------+-------------+
你叫什麼目標? – Scott 2010-09-21 14:21:36
需要更多細節 - 你能用文字描述你想要做什麼嗎? – egrunin 2010-09-21 14:22:01
嘗試將內部連接更改爲左側連接 – 2010-09-21 14:31:16