开发者

mysql datetime type and now -month

开发者 https://www.devze.com 2023-01-23 05:32 出处:网络
i need ge开发者_开发问答t all data from table, where insert date is befor month or after. Table:

i need ge开发者_开发问答t all data from table, where insert date is befor month or after.

Table:
id Name Date
1 Test2 2010-09-29 10:11:41
2 test4 2010-10-19 11:11:43
3 test4 2011-10-29 11:17:43


Is this what yo uare looking for -

This should give all data with date before a particular month -

SELECT * FROM Table WHERE month(Date) < <number_of_month>

and this should give you all data of date after a particular month -

SELECT * FROM Table WHERE month(Date) > <number_of_month>
0

精彩评论

暂无评论...
验证码 换一张
取 消