即使條件爲真,該請求返回其他結果 「ELSE RESULT」。My sql如果條件爲真,則返回else結果
SELECT
IF(Print_Server_Type='BW',SUM(Total_Impressions_Printed),'ELSE RESULT') AS BWTotalImpressions
FROM printedjob
WHERE
Account=''
And Job_Submission_Date>="2015-08-24"
AND Job_Submission_Date<="2015-08-28";
與where條件相同的請求工作正常
SELECT
SUM(Total_Impressions_Printed) AS BWTotalImpressions
FROM printedjob
WHERE
Account=''
And Print_Server_Type='BW'
And Job_Submission_Date>="2015-08-24"
AND Job_Submission_Date<="2015-08-28";
我使用的第一個請求,因爲我需要的結果是從選擇一列。
您可以編輯上面張貼含有這些行的表的樣本,與您所期望的查詢輸出爲樣品在一起嗎? –