I’m a complete SQL noob and have no idea how to utilize JOINs. If someone could help with this query, it would be great.
I have a table questions which contains two columns: queid and que.
Another table options, contains the corresponding options for the questions, and has columns optionid, queid,option.
How can I do a SELECT statement such that I can join both tables together based on queid ?
Something like:
SELECT * from questions,options where queid=1
You should try this:
INNER JOINloads questions and options having at least one corresponing record in every table.If you need to get all questions (even the ones not having options) you could use
LEFT JOINalways loads questions and, if they have options, their options too; if not you get NULL for options columns.