i have four tables
- user-question contains two columns: questionID, userID, the questions that the user answers.
- question-cell contains two columns: questionID, cellID the questions that will be asked in cell.
- question-place contains two columns: questionID, placeID the questions that will be asked in place.
- question contains two columns: ID, text
i want to know the number of cells question that the user (userID=3) has got
i think like this
select questionID
FROM `question-cell`
WHERE questionID in
(select questionID
from `user-question`
WHERE userID = 3 AND competitionID = 4
group by competitionID, userID)
and i want to know if that is write , because i am working on Notebad
I think you’re looking for the following query. Group Bys will not work in sub queries and you had quotes in places where you shouldn’t have them.