1

I have some rows in my database that contains some dates.

I need to select all dates based on a weeknumber, how is this possible?

janhartmann
  • 14,713
  • 15
  • 82
  • 138

2 Answers2

2

The T-SQL DATEPART function will take week (abbreviated form wk) as its first parameter. This will do what you want. Reference here:

http://msdn.microsoft.com/en-us/library/ms174420.aspx

David M
  • 71,481
  • 13
  • 158
  • 186
  • This helped me getting the right week number: http://stackoverflow.com/questions/348880/getting-week-number-off-a-date-in-ms-sql-server-2005 – janhartmann Jun 01 '10 at 12:50
0
select date from table_name where DATE_FORMAT(date, "%U-%Y")="11-2010"

where 11 is week number

and 2010 is year

Salil
  • 46,566
  • 21
  • 122
  • 156