我的查詢顯示錯誤,請問任何人都可以幫助我。如何編寫兩個案例語句以防案件
我的查詢:
SELECT A.EmpCodeC,
E.EmpNameC,
B.DesigNameC,
C.DeptNameC,
D.SecNameC,
A.ClockDateD,
TimeClk1N,
TimeClk2N,
TimeClk3N,
TimeClk4N,
A.BJClk1N,
A.BJClk2N,
A.BJClk3N,
A.BJClk4N,
A.TimeInN,
A.TimeOutN,
A.ShiftCodeC,
A.NormalN,
A.ActlWrkHrsN,
A.LatenessN,
A.UnderN,
A.OT10N,
A.OT15N,
A.OT20N,
A.OT30N,
A.SflatN,
A.ShiftAllN,
A.MealAllN,
A.TranAllN,
A.Oth1AllN,
A.Oth2AllN,
A.HealthAllN,
A.AttdAllN,
A.ReaCodeC,
A.SplReaCodeC,
Isnull(I.PayTypeC, '') PayType,
E.BasicSalaryN,
CASE
WHEN Datename(dw, A.ClockDateD)='Sunday' THEN
CASE
WHEN A.OT20N >4 THEN ((E.BasicSalaryN/(Substring(Cast(Eomonth (A.ClockDateD) AS VARCHAR(20)),9,2))/9)* (4+A.OT10N+A.OT20N+ A.OT30N))
ELSE ((E.BasicSalaryN /(Substring(Cast(Eomonth (A.ClockDateD) AS VARCHAR(20)),9,2))/9)* (A.OT10N+A.OT15N+ A.OT20N+ A.OT30N))
END AS OT_Amnt,
CASE
WHEN A.OT20N >4 THEN ((E.BasicSalaryN/(SubString(CAST(EOMONTH (A.ClockDateD) AS VARCHAR(20)),9,2))/9)* (A.OT15N-4))
ELSE ('0.00')
END AS Insentive_Amnt
ELSE '0.00' OT_Amnt '0.00' Insentive_Amnt
END
FROM Daily A
INNER JOIN TMSStrt.DBO.Designation B
ON A.DesigCodeC = B.DesigCodeC
INNER JOIN TMSStrt.DBO.Department C
ON A.DeptCodeC = C.DeptCodeC
INNER JOIN TMSStrt.DBO.Section D
ON A.SecCodeC = D.SecCodeC
AND D.DeptCodeC = C.DeptCodeC
INNER JOIN StaffMaster E
ON A.EmpCodeC = E.EmpCodeC
LEFT JOIN TMSStrt.DBO.Reason I
ON A.ReaCodeC = I.ReasonCodeC
WHERE A.ClockDateD >= '01-07-2016'
AND A.ClockDateD <= '04-07-2016'
ORDER BY E.EmpNameC,
A.ClockDateD
請修復您的格式。一行代碼每個可見寬度,並縮進4個空格以使文本等寬。 –
發佈大量文字並說它「顯示錯誤」,而沒有說出那些錯誤是什麼,它們出現在哪一行上,更重要的是你實際上想要達到的效果不太可能引起積極的反應。正如已經要求格式化您的代碼,確定導致錯誤的特定部分,描述您正在嘗試執行的操作,然後有人可能會幫助您。 – GarethD