Saturday, 15 June 2013

foreign keys - SQL query to find users that don't have any subscription to a specified list (many-to-many) -


Users have two tables, "user" and "lists" and many-to-many "membership" lists related to the table ( Thus, when the foreign key is user_id, and list_id ), it will be a single SQL query to find all users, which is not a subscription with a specific List_id (Naturally to include all users without any subscriptions)?

time out to break time does not exist again:

UusurID from the user, where is not present (select 1 of the membership where s.user_id = u.user_id and s.list_id = N) < / Div>

No comments:

Post a Comment