当需要对数据库中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';