I have a USERS
table with active and inactive users and I also have another table called Leaders
where team leaders are stored (so a list of users).
I want to delete those users in table Leaders
that are inactive in table users
.
Edit based on comments:
Users
table: ID and ActiveLeaders
table: IDYou could use an in
condition:
DELETE
FROM leaders
WHERE id IN (SELECT id
FROM users
WHERE active = 0 -- Or however you mark inactive users
)