简体   繁体   中英

DATE_SUB(CURRENT_DATE(), 7 day) … am I wrong?

I am trying to SELECT between CURRENT_DATE() and the last 7 days...So, this is what I got so far :

SELECT *
FROM `formulaires`.`summary`
WHERE (Date BETWEEN DATE_SUB(CURRENT_DATE(), 7 day) AND CURRENT_DATE());

So..yah, this aint working properly. Any suggestions ? Thanks!

Try:

SELECT *
FROM `formulaires`.`summary`
WHERE Date BETWEEN DATE_SUB(CURRENT_DATE(), interval 7 day) AND CURRENT_DATE();

(include "interval")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM