Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

Using static Day value in a particular Date - forum topic by janthony

$
0
0

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
 
 
 

Forums: 

Viewing all articles
Browse latest Browse all 14773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>