SQL query: Delete a entry which is not present in a join table?
Posted
by Mestika
on Stack Overflow
See other posts from Stack Overflow
or by Mestika
Published on 2010-04-12T06:42:54Z
Indexed on
2010/04/12
6:53 UTC
Read the original article
Hit count: 364
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
© Stack Overflow or respective owner