I have two tables: houses and users
houses
has a foreign key to user via the column user_id
. It has also a column called active which is either 'yes' or 'no'
users
has a column called active which is either 'yes' or 'no'
I want to run a query to update all the houses active column to be 'no' as long as their associated user has 'no' in its active column AND the house active column is not already 'no'.
I know how to update based on the users table value, but I don't know how to do it when the conditions are on both an associated table and its own table.