-1
我找一年的樞軸數據與MS SQL SERVER透視表
select month(createdatetime) as month,
year(createdatetime) as year,
count(*) as members
from [toneexcel].[dbo].[teUserMemberSIMAcc]
where year(createdatetime) > '2015' and status = 'AC'
group by month(createdatetime), year(createdatetime)
order by year(createdatetime), month(createdatetime)
請建議我這下面的查詢,TQ
電流輸出
Month| year | members
-----------------------
1 2016 12914
2 2016 13338
3 2016 13633
4 2016 11110
5 2016 9868
6 2016 7088
7 2016 6785
8 2016 8260
9 2016 8386
10 2016 8506
11 2016 7187
12 2016 7976
1 2017 8535
2 2017 12744
3 2017 579
預期輸出爲
Month | 2016 | 2017
----------------------
1 12914 | 8535
2 13338 12744
3 13633 579
4 11110
5 9868
6 7088
7 6785
8 8260
9 8386
10 8506
11 7187
12 7976
請出示樣品的數據和預期的輸出。 –
提供一些示例數據。 –
@madhan發佈問題本身的數據,而不是評論。你發佈的內容無濟於事 - 它只是一行數字。你想每年有一行,每月一次,是什麼? *更新*有關信息的問題。我會爲你做,但我不知道數據應該看起來像 –