1.获取每个月中的最后一条记录的日期
1: 2: 3: 4: 5: 6: 7: 8: 9: |
SELECT CONVERT(varchar(10),data,120) [Date] FROM (select data , ROW_NUMBER() OVER (PARTITION BY CONVERT(varchar(6),data,112) ORDER BY data DESC) rn from dbo.tbl_Performance where id_prod =1 ) T WHERE rn=1 order by data |