I have three tables one called facility
, one hotel
and the other hotel_facility
which is the join table for hotels and facilities. So far so good. I have many duplicates in the facility
table. I want to update the join table and then delete the duplicates in the facility
table. Finding the duplicates and deleting them is not a problem:
select o.id
from facility o
where exists ( select 'x' from facility i where i.name = o.name);
and then I delete based on this query. But how about updating the join table how would I go about doing this, I am using the latest version of Postgres. Can I use something like Update table using newest value in another table
Thanks