注册 登录
编程论坛 SQL Server论坛

[求助]怎样用SQL求得十一月的最后一个星期四的日期?

secondonsite 发布于 2007-08-13 10:36, 583 次点击
第一次上这个坛子,给点儿鼓励,谢谢!我的问题是:
怎样用SQL求得十一月的最后一个星期四的日期?
3 回复
#2
sky_yang_sky2007-08-13 12:01
select max(date) from tablename where date>='2007/11/01' and date<='2007/11/30' and datename(weekday,date)='thursday'
#3
secondonsite2007-08-14 17:23
谢谢!好方法就是简单!
#4
Kendy1234562007-08-14 17:35
select date from table1 where date between '20071124' and '20071130' and datetime(weekdat,date) = 'thursday'

一个月的最后7天肯定有且仅有一个星期四
1