我已經產生輸出就像一個存儲過程:SQL Server過程需要修改
Success Fail Progress
----------------------------
1 2 3
但我想輸出是:
Recieved Count
----------------
success 1
----------------
fail 2
----------------
progress 3
請有人可以幫助我從得到這個輸出我的sql服務器。
當前的SQL:
select
sum(case when status='AK' then 1 else 0 end) as 'SUCCESS',
sum(case when status='E' then 1 else 0 end) as 'FAILURE',
sum(case when status NOT IN('AK','E')then 1 else 0 end) as 'PENDING'
from t
where [rec_datetime] BETWEEN '2008-02-11' AND DATEADD(DAY,1,'2008-02-11')
你可以發表你的SELECT語句的代碼,因爲它是現在? – JamieA
sum(status ='AK'then 1 else 0 end時的情況)爲'SUCCESS', sum(status ='E'then 1 else 0 end時的情況)爲'FAILURE', sum IN('AK','E')then 1 else 0 end)as'PENDING' from t where [rec_datetime] BETWEEN'2008-02-11'and DATEADD(DAY,1,'2008-02-11' ) – user1268906
當然。更改您的存儲過程輸出。 – Kermit