This content has been marked as final. Show 4 replies
Rb2000rb65 wrote:Good idea!
The solution may not be using minus as long as I am getting my results using the latest functions it is good with me.
MINUS is not the best tool for this job. The query you posted gets the exam_cd and candid that you want, but it can't get the record_seq because there's nothing like record_seq in table1.
You can do it this way:
I suppose you could use MINUS, like this
SELECT * FROM table2 m WHERE NOT EXISTS ( SELECT 1 FROM table1 WHERE m.candid = candid AND m.exam_cd IN ( exam_cd1 , exam_cd2 , exam_cd3 ) ) ;
but it's unecessarily complicated.
SELECT * FROM table2 WHERE (exam_cd, candid) IN ( SELECT ... -- The MINUS query you posted goes here ) ;