Delete record

  • I have a table called country with fields ID and CountryName

    This fields are referenced in more five tables either using ID or Countryname directly

    Now I want to delete Some records from Table country on condition that if records are not present in any of the other five tables

    If present then dont delete

    I want the optimized queryfor .....

  • DELETE FROM Country

    WHERE Id NOT IN (SELECT ID FROM Table1)

    AND CountryName NOT IN (SELECT CountyName FROM Table2)

    AND ....Table5)

  • Thanks Suresh you have solved my problem

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply