给定以下 2 个表:
PROJ_CUSTOM PSR_FINAL_DATA
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
PROJ_ID PROJ_NAME PROJ_ID ACCT_ID
61000.001.ABC Accounting 61000.001.ABC 610-10-23
61000.001.ABD Marketing 61000.001.ABD 610-20-23
61000.001.ABE Applications 61000.001.ABE 610-30-23
61000.001.ABF HR 61000.001.ABF 610-40-23
61000.001.ABG Foo 61000.001.ABG 610-50-23
61000.001.ABC Accounting 61000.001.ABC 610-10-23
61000.001.ABD Marketing 61000.001.ABD 610-20-23
61000.001.ABE Applications 61000.001.ABE 610-30-23
61000.001.ABF HR 61000.001.ABF 610-40-23
61000.001.ABG Foo 61000.001.ABG 610-50-23
以及以下sql:
SELECT PROJ_ID, PROJ_NAME
FROM DELTEK.PROJ_CUSTOM
INNER JOIN
(
SELECT PROJ_ID AS Project
FROM DELTEK.PSR_FINAL_DATA
GROUP BY PROJ_ID
) FinalDb
ON FinalDb.Project = PROJ_ID
WHERE PROJ_ID LIKE '61000.001.[A-Z]%';
sql 返回列 PROJ_ID 和 PROJ_NAME。
我如何能够添加表 2 (PSR_FINAL_DATA) 中的 ACCT_ID 列?