开发者

Getting dates based on week number

开发者 https://www.devze.com 2023-01-01 13:49 出处:网络
I have some rows in my database that 开发者_如何学JAVAcontains some dates. I need to select all dates based on a weeknumber, how is this possible?The T-SQL DATEPART function will take week (abbreviat

I have some rows in my database that 开发者_如何学JAVAcontains some dates.

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


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


select date from table_name where DATE_FORMAT(date, "%U-%Y")="11-2010"

where 11 is week number

and 2010 is year

0

精彩评论

暂无评论...
验证码 换一张
取 消