user1926138 user1926138 - 1 year ago 87
SQL Question

Delete non-matching data from table

I have a table and back-up of same table. After taking back-up inserted some data in the main table. Now I want to delete data from main table. How to achieve it.
Let say table is 'BookMap' with column AuthorID, BookName, BookID. Took backup of 'BookMap' table and inserted new data. Now want to delete this data.
NOTE: I dont have promary key here.

Answer Source

If you want BookMap to look just like the backup_BookMap, then you might consider:

truncate table bookmap;

insert into bookmap( . . .)
   select . . .
   from backup_bookmap;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download