The first table is pre
and the second is tran
. I want the S_SSN
from tran
where no
and Code
of transcript matches with Code
and no
in pre
Is this what you want?
;WITH Cte AS(
SELECT
t.Student_SSN,
cc = COUNT(t.Student_SSN)
FROM transcript t
INNER JOIN prereq p
ON t.C_no = p.P_no
AND t.D_Code = p.P_Code
WHERE
p.D_Code = 'INFS'
AND p.C_no = 614
GROUP BY t.Student_SSN
)
SELECT DISTINCT Student_SSN
FROM Cte
WHERE cc = (SELECT COUNT(*)
FROM prereq p
WHERE p.D_Code = 'INFS' AND p.C_no = 614)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.