所以我用這個查詢計數驗證錯誤的數目在我的數據庫:骨料凡多選擇查詢的SQL
SELECT (
SELECT COUNT(audit.server_response_code)
FROM audit Where audit.server_response_code = '401'
) AS Locked,
(
SELECT COUNT(audit.server_response_code)
FROM audit Where audit.server_response_code = '403'
) AS unlocked,
(
SELECT COUNT(audit.server_response_code)
FROM audit Where audit.server_response_code = '490'
) AS Passforget,
(
Select Count (audit.server_response_code)
From audit where audit.server_response_code = '491'
) AS invalid
查詢工作正常,但是我想補充一個聚合where語句這適用於四個陳述。我該怎麼辦?
你可以在'SELECT'外面添加一個'WHERE' - 這是你的意思嗎? –
我嘗試使用where外部select語句,但它給了我一個錯誤,指出from子句丟失,我使用了from子句但它沒有工作 –
查看我想要添加的聚合的'filter()'子句 –