數據庫按年月查詢語句

當需要對數據庫中date數據段(字段名pdate)的年、月、日查詢時,

分別使用year(pdate)、month(pdate)、day(pdate)查詢。

如要查詢特定月份的記錄,sql語句如下:

select * from table1 where year(pdate)='2010' and month(pdate)='12';

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章