0
SELECT *
CASE
WHEN (Employees.End_Date is null)
THEN select
EmpId,
Emp_Name,
Salary ,
Start_date ,
End_dat ,
DATEDIFF(DATE_ADD(Start_Date, INTERVAL 30 DAY), Start_Date) * Salary/30 as 'Total_Salary'
from Employees
ELSE Select
EmpId,
Emp_Name,
Salary ,
Start_date ,
End_date ,
DATEDIFF(End_Date, Start_Date) * Salary/30 as 'Total_Salary'
from Employees
END
From Employees;
我已經嘗試了很多,但此查詢中的錯誤未得到解決。選擇查詢案例問題
我想區分如果結束日期爲null或不在表中的語句。
您嘗試解決錯誤的任何時間,這些錯誤應該被列入問題。此外,標題應該比「選擇查詢案例問題」選擇得更好,這樣如果他們有相同的問題,其他人會發現問題更容易。 –