Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
SELECT WEEK( `date_posted` ) AS week, COUNT( 1 ) AS aantal FROM `news` GROUP BY week ORDER BY week DESC LIMIT 0 , 10
これは機能しません。出力は次のとおりです。
week aantal 52 41 51 56 50 49 49 56 48 62
しかし、まだ 52 週目ではありません。何が問題なのですか?
WHERE句が必要だと思います:
WHERE
SELECT WEEK( `date_posted` ) AS week, COUNT( 1 ) AS aantal FROM `news` WHERE `date_posted` >= (curdate() - interval 10 week) GROUP BY week ORDER BY week DESC LIMIT 0 , 10