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

Split the dates bi-weekly - response (6) by Kawish_Siddiqui

$
0
0

Following might solve your issue or help you to solve this query.

SELECT Start_Date, End_Date
FROM
(
	SELECT calendar_date End_Date, ROW_NUMBER() OVER(ORDER BY calendar_date) RowNum
	FROM sys_calendar.CALENDAR
	WHERE calendar_date BETWEEN '2013-01-01' AND '2013-12-31'
	  AND day_of_week = 1  --Sunday
	 QUALIFY RowNum MOD 2 = 1
) ed
INNER JOIN 
(
	SELECT calendar_date Start_date, ROW_NUMBER() OVER(ORDER BY calendar_date) RowNum
	FROM sys_calendar.CALENDAR
	WHERE calendar_date BETWEEN '2013-01-01' AND '2013-12-31'
	  AND day_of_week = 2  -- Monday
	 QUALIFY RowNum MOD 2 = 1
) st
ON st.RowNum+2 = ed.rownum

 


Viewing all articles
Browse latest Browse all 14773

Trending Articles



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