我怎样才能找到特定的日子
我有这样的日期值 - 12/2011 或 11/2011 (MM/yyyy
)
我想找到特定月份的星期日......
例如,如果我选择月份 01 /2012,查询应该给出这样的结果
01
08
15
22
29
上面的日期是星期日。
01/2012
月的预期输出
01
08
15
22
29
如何进行查询
需要查询帮助
I have the date value like this - 12/2011 or 11/2011 (MM/yyyy
)
I want to find the sundays on the particular month....
For Example, If i select the month 01/2012, The query should give the result like this
01
08
15
22
29
The above date are sunday.
Expected Output for 01/2012
Month
01
08
15
22
29
How to make a query
Need Query Help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
借助数字表(
master..spt_values
)With a little help of a number table (
master..spt_values
)来了:
Here it comes:
编辑:使用数字表代替 CTE,因为您使用的是 SQL Server 2000。来吧,升级并帮自己一个忙
Edit: use a numbers table in place of the CTE because you are in SQL Server 2000. C'mon, upgrade and do yourself a favour
您可以更改日期格式并使用 DateName 函数。
SELECT 日期名称(dw, GETDATE())
You can change date format and use DateName function.
SELECT DateName(dw, GETDATE())