Reputation: 4647
I have a kind of metadata table in my database that I want to cull of old records. I have created a "select" statement that selects the rows I want to delete:
select m.tablename, m.OWNERNAME
from MAPINFO.MAPINFO_MAPCATALOG m
left outer join sys.ALL_TABLES t
on TRIM(m.tablename) = t.TABLE_NAME and TRIM(m.OWNERNAME) = t.owner
where t.num_rows is null
This gives me 113 rows.
However, I can't figure out how to convert this to a "delete". I was going to just use:
delete from MAPINFO.MAPINFO_MAPCATALOG where tablename in (...)
But this deletes 115 rows. There are two problems:
Given the above, how should I go about performing this delete?
Upvotes: 0
Views: 147
Reputation: 132580
You can do this:
delete from MAPINFO.MAPINFO_MAPCATALOG where (tablename, ownername) in (...)
Upvotes: 1