如圖:
其中Num是自增長列,Operation是分類標簽,count是匯總數據
腳本如下:
復制代碼 代碼如下:
select Num=row_number() OVER(order BY HT_Resv.OperationStatus),HT_Resv.OperationStatus ,
CASE HT_Resv.OperationStatus
WHEN '3' THEN '成功'
WHEN '4' THEN '失敗'
end as 'Status',count(HT_Resv.Id) as 'Count'
FROM ht_resv group BY HT_Resv.OperationStatus