Hi everyone,
I am new to databases and I am needing some help doing a particular query I am not sure how to code.
I have three tables:
user: with fields id, name, login, password
user_expertise: with fields id, name
questions: with fields id, user_id, expertise_id
A user can be an expert on multiple areas. Therefore, a user defined in the user table has many entries in the user_expertise table.
A user can have multiple questions. This way, a user defined in the user table can have many questions stored in the questions table by user_id and expertise_id he needs help from.
I need to do a query that selects all the entries from the questions table that match all the expertise areas defined for a user.
I know how to do a query for one expertise area for a user in the questions table, however I do not know how to create a query that iterates through all the expertise areas or values defined for a user on the user_expertise table in order to get all the entries that match that set of multiple values in questions table.
Thanks in advance and please forgive my bad english!
