5
我有一個用戶表,我試圖想出一個查詢,該查詢返回按日期分組的所有用戶總數以及用戶總數按特定客戶的日期分組。在條件爲真的情況下,SQL中的總計數和條數爲
這裏是我迄今,那裏的按日期分組用戶的總數,但似乎無法弄清楚如何獲得這些用戶的數量,其中user.client_id = X
SELECT user.created,
COUNT(user.id) AS overall_count
FROM user
GROUP BY DATE(user.created)
努力了行的結果是這樣的:
[created] => 2010-05-15 19:59:30
[overall_count] => 10
[client_count] => (some fraction of overall count, the number of users where
user.client_id = x grouped by date)
這就是它 - 謝謝! – twmulloy 2010-05-16 06:37:58