私はffを持っています。クエリ
SELECT X.TBL_ID, X.TN, X.SN, X.FAIL, X.TEST_DESC, Y.TOTAL_ROW
FROM
(SELECT
A.ID AS TBL_ID,
B.TEST_NUM AS TN,
B.SITE_NUM AS SN,
SUM(IIF(STATUS = 'FAIL', 1, 0)) FAIL,
CASE
WHEN (TEST_DESC CONTAINING 'OPEN') THEN 'OPEN'
WHEN (TEST_DESC CONTAINING 'SHORT') THEN 'SHORT'
WHEN (TEST_DESC CONTAINING 'Kelvin') THEN 'KELVIN'
ELSE 'UNKNOWN'
END AS TEST_DESC
FROM T_TABLE2 B
JOIN T_TABLE1 A
ON B.TBL1_ID = A.ID
WHERE A.DEVICENAME = 'SAJO7A159E_P59'
AND A.TESTER = 'T932-M2M-077'
AND B.TEST_NUM = 'T201'
OR B.TEST_NUM = 'T202'
OR B.TEST_NUM = 'T203'
OR B.TEST_NUM = 'T204'
OR B.TEST_NUM = 'T205'
OR B.TEST_NUM = 'T206'
OR B.TEST_NUM = 'T207'
OR B.TEST_NUM = 'T208'
OR B.TEST_NUM = 'T209'
OR B.TEST_NUM = 'T210'
OR B.TEST_NUM = 'T211'
OR B.TEST_NUM = 'T601'
OR B.TEST_NUM = 'T602'
OR B.TEST_NUM = 'T603'
GROUP BY
A.ID,
B.TEST_NUM,
B.SITE_NUM,
B.TEST_DESC
ORDER BY B.TEST_NUM) X,
(SELECT (MAX(DEVICE) - MIN(DEVICE) - 1) AS TOTAL_ROW FROM T_TABLE3 WHERE TBL1_ID = X.TBL_ID) Y
しかし、そのクエリにはエラーColumn unknown があります。X.TBL_ID。. 最初のサブクエリのエイリアス TBL_ID を 2 番目のサブクエリの WHERE 句に使用したいと考えています。
これから私を助けてください。
ありがとう!!!:)