1
$SQLString = "SELECT
count(score) as counts,
DATE(date),
SUM(CASE WHEN gender = 1 then 1 ELSE 0 END) Male,
SUM(CASE WHEN gender = 2 then 1 ELSE 0 END) Female,
AVG(age) as age, score
FROM persons
WHERE date > '".$_SESSION['date1']."' AND date < '".$_SESSION['date2']."'
GROUP BY DATE(date)
ORDER BY DATE(date) asc";
這是我的查詢,顯示一些數據,如性別,年齡等每天。 如何將這些日期按月份或年份彙總並顯示添加的數據?如何按月份或年份彙總日期Mysql
通知我,如果我不是解釋我自己以及:)
哇,我從來沒有那麼簡單:D謝謝 – pleaseDeleteMe