當需要對數據庫中date數據段(字段名pdate)的年、月、日查詢時,
分別使用year(pdate)、month(pdate)、day(pdate)查詢。
如要查詢特定月份的記錄,sql語句如下:
select * from table1 where year(pdate)='2010' and month(pdate)='12';
當需要對數據庫中date數據段(字段名pdate)的年、月、日查詢時,
分別使用year(pdate)、month(pdate)、day(pdate)查詢。
如要查詢特定月份的記錄,sql語句如下:
select * from table1 where year(pdate)='2010' and month(pdate)='12';