...Technology Simplified

Friday, April 20, 2012

DELETE based on 2 tables

No comments :

select a.*
from temp1 a,
patient b
WHERE a.chart_no = b.chart_no
and b.group_assignment = 'AAA'
How do I delete only records from temp1?

DELETE FROM TEMP1
WHERE CHART_NO IN(
SELECT A.CHART_NO
FROM TEMP1 A,
PATIENT B
WHERE A.CHART_NO = B.CHART_NO
AND B.GROUP_ASSIGNMENT = 'AAA' )

No comments :

Post a Comment