I’m looking to only show records where a row exists in a child table.
I have two tables. I only want to return records from IP_OP that contain at least 1 record in CD_REVIEWS. I can’t figure out how to accomplish this.
SELECT
IP_OP.PATIENT_CTRL_NUM,
IP_OP.ADMIT_HOUR,
CD.REVIEW_DATE
FROM
IP_OP_PATIENT_DET IP_OP,
CD_REVIEWS CD
WHERE
Both tables contain PATIENT_CTRL_NUM.
It depends on which review_date you want ot select, but something like this should work:
If you are fine with returning multiple IP_OP_PATIENT_DET records then you could lose the
MAXandGROUP BY