oracle数据库product表里面存储了一些数据,product表里有一字段saledate,存储的类似于2008-5-22格式的数据,我现在只想用查2009-09月的数据,应该怎么查?用select name,price,saleCount,to_char(saledate,'yyyy-mm-dd') as saleDate from product where saleDate like '%2009-09%' order by saleDate 不行,网上有一答案如下:
select * from news where
substring(Convert(char(10),date,112),1,8)='20090112'按日查
substring(Convert(char(10),date,112),1,8)='20090112'
按月查
substring(Convert(char(10),date,112),1,6)='200901'
按年查
substring(Convert(char(10),date,112),1,4)='2009' 试了一下也不行。谁能帮帮我
select * from news where
substring(Convert(char(10),date,112),1,8)='20090112'按日查
substring(Convert(char(10),date,112),1,8)='20090112'
按月查
substring(Convert(char(10),date,112),1,6)='200901'
按年查
substring(Convert(char(10),date,112),1,4)='2009' 试了一下也不行。谁能帮帮我
where to_char(saledate,'yyyymm')=='200909'
select name,price,saleCount,saledate from product where substr(saledate,1,7)='2009-09' order by saleDate
where to_char(saledate,'yyyymm')=='200909'