SQL query: Delete a entry which is not present in a join table?
- by Mestika
Hi,
I’m going to delete all users which has no subscription but I seem to run into problems each time I try to detect the users.
My schemas look like this:
Users = {userid, name}
Subscriptionoffering = {userid, subscriptionname}
Now, what I’m going to do is to delete all users in the user table there has a count of zero in the subscriptionoffering table. Or said in other words: All users which userid is not present in the subscriptionoffering table. I’ve tried with different queries but with no result.
I’ve tried to say where user.userid <> subscriptionoffering.userid, but that doesn’t seem to work. Do anyone know how to create the correct query?
Thanks
Mestika