 |
 |
Archives of the TeradataForum
Message Posted: Sat, 18 Aug 2007 @ 08:40:53 GMT
Subj: | | How to find Number of days in a year from SQL |
|
From: | | VENKATESWARLU Kuriseti |
All,
Right now I am using Teradata SQL Assistant 7.1.0 for my DWH project. I need to write an SQL where the FIS_WK_KEY between the current year of
day and next year of days. Here is the following SQL hard-coded days manually.
SELECT DISTINCT
A.COL1, B.COL2, C.COL3,
FROM
TABLE_A A, TABLE_B B, TABLE_C C
WHERE
A.COL1 = 5 AND
B.COL2 = 4 AND
(A.COL2 BETWEEN B.PROCESS_DATE - 365 AND B.PROCESS_DATE + 365)
From the above SQL, Want to use date function and instead of hard-coding number of days (-365 & +365) need to use date functions and
find out number of days. Please help me.
Thanks,
Venkat
| |