Need help building SQL Query (simple JOIN)
Posted
by Newbie
on Stack Overflow
See other posts from Stack Overflow
or by Newbie
Published on 2010-06-08T09:41:15Z
Indexed on
2010/06/08
9:52 UTC
Read the original article
Hit count: 206
Hello! In my database, I have a "users", a "quests" and a "questings" table. A user can solve a quest. Solving a quest will save the "user_id" and the "quest_id" in my "questings" table.
Now, I want to select all quests, a user has NOT solved (meaning there is no entry for this user and quest in "questings" table)!
Let's say the user has the id 14. How to write this query?
After solving this query, I want to filter the results, too. A quest and a user has a city, too. What to do for writing a query which returns all quests, a user has NOT solved yet, in the users city (user city == quest city)?
© Stack Overflow or respective owner