Link to home
Start Free TrialLog in
Avatar of schuitkds
schuitkds

asked on

sql compare date ranges based on week#'s

I am looking for a way to design a query in SQL to  compare date ranges based on week#
current years  week# range compared to previous year(s) date ranges with the same week# as current period.

one issue i have seen is some years have 53 weeks?

any help or guidance would be greatly appreciated
Avatar of schuitkds
schuitkds

ASKER

also want to use Mondays as the first day of the week
Avatar of Kyle Abrahams, PMP
I have found the f_table_date function found here:
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=61519

to be extremely powerful and helpful.


select * from dbo.F_TABLE_DATE('1/1/2015', '1/1/2016')

you have the start_of_week_starting_mon_date as a field and the iso_week_no as a week number.
ASKER CERTIFIED SOLUTION
Avatar of Tomas Helgi Johannsson
Tomas Helgi Johannsson
Flag of Iceland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial