クエリ1:
SELECT COUNT (A.EMPNO) AS [PRESENT]
FROM ERPDATA.NIITESS.DBO.ZEMP_MASXST_WEB_AL A INNER
JOIN PPA_EVENTWISEEMPLOYEEMASTER B ON
(CASE B.VC_BA WHEN '%' THEN LTRIM(RTRIM(A.PDIBUSHORT)) ELSE B.VC_BA END) = LTRIM(RTRIM(A.PDIBUSHORT))
AND (CASE B.VC_PA WHEN '%' THEN A.PA ELSE B.VC_PA END) = A.PA
WHERE A.STATUS = 3
AND A.EMPNO IN (SELECT VC_EMPCODE FROM ERPDATA.NIITESS.DBO.ADA_MXEASTER WHERE IN_ATTENDANCE_STATUS = 1 AND CH_ACTIVE = 'Y' AND VC_EMPCODE <> '')
GROUP BY B.IN_EVENTID
クエリ2:
SELECT COUNT (A.EMPNO) AS [TOTAL]
FROM ERPDATA.NIITESS.DBO.ZEMP_MASXST_WEB_AL A INNER
JOIN PPA_EVENTWISEEMPLOYEEMASTER B ON
(CASE B.VC_BA WHEN '%' THEN LTRIM(RTRIM(A.PDIBUSHORT)) ELSE B.VC_BA END) = LTRIM(RTRIM(A.PDIBUSHORT))
AND (CASE B.VC_PA WHEN '%' THEN A.PA ELSE B.VC_PA END) = A.PA
WHERE A.STATUS = 3
2つの結果を、列がない2つの列にマージしたい=クエリ2-クエリ1-処理速度を速くします。どうすればいいですか?例:
2つの結果があります:
//----------------------------------------クエリ:1
1
2
3
4
// --------------------------------------クエリ:2
4
5
6
8 //------------------------------------
2
列の結果AS15
2 6
3 7
4 8