Archives of the TeradataForum
Message Posted: Sat, 05 Sep 2009 @ 08:46:18 GMT
I am new to Teradata and have a SQL Server background. Thanks for your help
I am trying to write a query in which I need to assign a filter based on day of the week
Select * from Loan Where Application_Date between Date and (Date-1)
I want to make this dynamic so if it s a Monday the where clause should change to Application_Date between Date and (Date-3).
I read the post about using sys.calendar table to get the week day, however I am unable write a case statement within the Where clause to get the logic I need
I tried to take a swing at it but it gives me syntax errors. The query I use is mentioned below. Also I don t have the permissions to create variables or stored procedures I am trying to implement this with SSIS.
Select * from Loan Where Case when (select day_of_week from sys_calendar.calendar where calendar_date = date ) <> 2 Application_Date between date - 1 AND date - 1 else infx_loan_app_date_ln000_date between date - 3 AND date - 1 end
|Copyright 2016 - All Rights Reserved|
|Last Modified: 28 Jun 2020|