數我所說的表日曆和數據的模樣:計算周
Date Week_Num Month_Year
1996-01-27 00:00:00.000 1021 01/1997
1996-01-28 00:00:00.000 1021 01/1997
1996-01-29 00:00:00.000 1021 01/1997
1996-02-03 00:00:00.000 1022 01/1997
1996-02-04 00:00:00.000 1022 01/1997
1996-02-10 00:00:00.000 1023 01/1997
1996-02-11 00:00:00.000 1023 01/1997
我要計算在MONTH_YEAR週數:
我寫了類似的查詢:
Select Month_year,Count(*)
From (Select Week_Num,Month_year
From Calendar
Group By Week_Num,Month_year
)a
Group By Month_year
order by Month_year
這是給我我想要什麼,但有沒有更好的方法呢?
您可以通過32秒打我,哎呀! :) –
@JNK不,這是不是我想要的例如在上面的數據otput應該返回我3自Month_year 01/1997有三個星期了。 – Peter
@彼得 - 它是什麼回報呢? – JNK