Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Tue, 29 Apr 2008 @ 22:38:32 GMT

  <Prev Next>   <<First <Prev Next> Last>>  

Subj:   Re: Case Statement and Crystal Reports
From:   cblake

Hi Neetha -

I assume this is in the where clause of your SQL Statement, and the logic you are going for is - if it is the first day of the month, pull last month, otherwise, pull the current month?

If so, I'd do it like this:

     and extract(year from snpsht_dt) = extract(year from (current_date -
     extract(day from current_date)))
     and extract(month from snpsht_dt) = extract(month from (current_date -
     extract(day from current_date)))

If you want to keep the logic more like you've got it, I believe you have to have the syntax more like:

     and snpsht_dt > CASE Logic Here
     and snpsht_dt < More CASE Logic here

  <Prev Next>   <<First <Prev Next> Last>>  
  Top Home Privacy Feedback  
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 28 Jun 2020