CurrencyId LeftCurrencyId RightCurrencyId ExchangeRateAt ExchangeRate
1 1 5 2013-06-27 00:51:00.000 39.
2 3 5 2013-06-26 01:54:00.000 40.0120
3 1 5 2013-06-26 00:51:00.000 49.0143
4 3 5 2013-06-25 14:51:00.000 33.3123
5 3 5 2013-06-25 06:51:00.000 32.0163
6 1 5 2013-06-25 00:08:00.000 37.
根據leftcurrencyid和rightcurrencyid的組合,我需要最近n天每天的最新記錄。使用MS Sql Server獲取最近n天的每日最新紀錄
還有,你試過嗎?順便說一句,哪個SQL Server版本? –
你可以添加輸出應該是什麼樣子?和一些實際的SQL與表和數據太 – gbn
@Panagiotis Kanavos:它是2008 R2 – RookieStacker