Similar to the above question I would like to find a date range based on current columns.
In my table I have a column called Mthend which is a fixed date eg 2014-02-28
I would like a piece of code that I can use without having to put any fixed dates in a where statement so it works out what the start of that month is and returns a between eg
If Mthend = 2014-02-28 then range would be between MnthStart and Mthend and the result would check from 2014-02-01 and 2014-02-28.
I am very new to Teradata SQL so any help is very much appreciated.
Hello every one ...
I need a help
I have two tables and there is common field between those two table that is 'DP_INSERT_DATE' and the format of the date is "YYYY-MM-DD.T.MM:SS:(time zone also)"
I need to join the tables using DP_INSERT_DATE and get the information....
Can you please help in the query thanks alot.
You can mail me at email@example.com
Here is the sql which gives you first and last day of the given date(2014-03-28) of the month.
select (ADD_MONTHS(cast('2014-03-28' as date) - EXTRACT(day FROM cast('2014-03-28' as date)) + 1,0)) as MnthStart
,(ADD_MONTHS(cast('2014-03-28' as date) - EXTRACT(day FROM cast('2014-03-28' as date)) + 1,1) -1) as MnthEnd