我的查询结果出错了。
我要做的是获取unique
数据。
Employeenames
会有所不同,但会从columns
的其余部分获取相同的数据。
SELECT A.MONTH
,(
SELECT SUM(AMOUNT)
FROM V_HR_PP_PROCESS_DATA
WHERE EMPLOYER_CODE = A.EMPLOYER_CODE
AND TAX_YEAR = A.TAX_YEAR
AND PROCESS_MONTH = A.MONTH
AND EMPLOYEE_ID IN (
SELECT EMPLOYEE_ID
FROM I_HR_EMP_EMPLOYMENT_DTL
WHERE EMPLOYER_CODE = A.EMPLOYER_CODE
AND CONTRACT_TERM = 'P'
)
AND PROCESS_MONTH BETWEEN 1
AND 10
AND PD_CODE = 'Z500'
) AS GROSS_PERMANENT
,b.EMPLOYEE_NAME AS employeename
,(
SELECT SUM(AMOUNT)
FROM V_HR_PP_PROCESS_DATA
WHERE EMPLOYER_CODE = A.EMPLOYER_CODE
AND TAX_YEAR = A.TAX_YEAR
AND PROCESS_MONTH = A.MONTH
AND EMPLOYEE_ID IN (
SELECT EMPLOYEE_ID
FROM I_HR_EMP_EMPLOYMENT_DTL
WHERE EMPLOYER_CODE = A.EMPLOYER_CODE
AND CONTRACT_TERM = 'F'
)
AND PROCESS_MONTH BETWEEN 1
AND 10
AND PD_CODE = 'Z500'
) AS GROSS_CASUAL
FROM I_HR_SYS_DATE_MONTHLY A
INNER JOIN I_HR_EMPLOYEE_MASTER b ON b.EMPLOYER_CODE = A.EMPLOYER_CODE
答案 0 :(得分:0)
最后添加
if yada yada
x = f(x) %// If you don't have anything here, you should use "if ~yada yada"
%// instead of "else"
else
while k>1 && x == true %// BTW: Lower case t in true
x = g(y) %// I hope you have something more than "k=k-1" in this loop
k = k-1;
end
end
选择后或group by A.MONTH,A.TAX_YEAR,A.EMPLOYER_CODE, b.EMPLOYEE_NAME
试试这个
distinct