MSSQL按季度排行怎么写呢?
发布网友
发布时间:2023-06-08 15:36
我来回答
共1个回答
热心网友
时间:2023-06-23 19:27
--SQL函数datepart(q,date),为分离出date所处的季度,year(date),这个容易理解了,所以应该写成如下的语句:
sql = "select top 6 count(Info_ID) as aa,Info_Editor from Article where datepart(q,Info_Date )=datepart(q,'" & date() & "') and year(Info_Date) = year('"& date() &"') group by Info_Editor order by count(Info_ID) desc,Info_Editor desc"