MySQL query queries a time record through a field of date type
2010-04-29 16:22:34| Category: Default categories | report | font size subscription download Lofter client
SELECT * FROM Wap_content where week (created_at) = Week (now)
If you want to be strict with a certain year, that can be
Query Day:
SELECT * FROM table where to_days (column_time) = To_days (now ()); SELECT * FROM table where date (column_time) = Curdate ();
Query one week:
SELECT * FROM table where Date_sub (Curdate (), INTERVAL 7 day) <= DATE (column_time);
Query one months:
SELECT * FROM table where Date_sub (Curdate (), INTERVAL INTERVAL 1 MONTH) <= DATE (column_time);
Query a few days:
The keyword between equals the datetime >= 2010-02-02 00:00:00 ' and datetime <= ' 2010-02-15 00:00:00 ';
SELECT * FROM table where datetime between ' 2010-02-02 00:00:00 ' and ' 2010-02-15 00:00:00 ';
Read (3733) | Comments (0)
MySQL time query