首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > oracle >

oracle 初级菜鸟着急地问个日期匹配的有关问题

2011-12-10 
oracle 初级菜鸟着急地问个日期匹配的问题有个列列出了日期,其值形如:2006-9-3我就找2006年的纪录,如何写s

oracle 初级菜鸟着急地问个日期匹配的问题
有个列列出了日期,其值形如:2006-9-3
我就找2006年的纪录,如何写
select   *   from   this_table   where   this_table.rcddate=   2006   ??????不对,怎么改

[解决办法]
查询为2006年的纪录
select * from this_table where to_char(this_table.rcddate, 'YYYY ')= '2006 '

查询为200608月份的纪录
select * from this_table where to_char(this_table.rcddate, 'YYYYMM ')= '200608 '

查询为20060831月份的纪录
select * from this_table where to_char(this_table.rcddate, 'YYYYMMDD ')= '20060831 '


热点排行