Hi ..
Have a requirement in which I have to search particular day for the current month , the query is running .. For ex . If I am running query for May'2013 the where condition should be resolved to ( where date = 05/11/2013 ) ( Where 11 is the static value )
I tried this using below option , wanted to know if there is any better way of doing this , as I have to use couple of values using IN clause , For ex. ( where date in 05/11/2013 , 05/15/2013 , 06/11/2013 )
Here is the where condition I am using
where
cycle_date in (
case
when EXTRACT(MONTH FROM DATE) < 9
then cast ( '0'|| trim(trim(EXTRACT(MONTH FROM DATE)) || '/11/' || trim(EXTRACT(year FROM DATE))) as date format 'mm/dd/yyyy')
else
cast ( trim(trim(EXTRACT(MONTH FROM DATE)) || '/11/' || trim(EXTRACT(year FROM DATE))) as date format 'mm/dd/yyyy')
end
Tags:
Forums: