I want to compare two table T1 and T2 and delete records from T1 which has form_no less than the form_no selected form T2.
I have written following query, but it is not working.
DELETE FROM T1
WHERE --Some Condition--
AND
FORM_NO < (ISNULL((SELECT DISTINCT(FORM_NO) FROM T2 WHERE --Some Condition--), 0))
Try this one… wish you could provide us the full query though..