I am trying to select a tshirts which the user has not voted on yet (from another table "votes")
"submissions" is the table with the tshirts
"votes" is the table that holds votes
"votes" structure is: ID, TEE, USER (where votes.tee == submissions.id)
This is the mysql statement I am trying:
SELECT
submissions.name,
submissions.id,
submissions.uploader,
submissions.image_vote
FROM
submissions,votes
WHERE
submissions.date_voted IS NOT NULL AND
submissions.id NOT IN (SELECT tee FROM votes WHERE tee=submissions.id AND user='3')
LIMIT 1
Now from what I understand I cannot use "tee=submissions.id" because it is from a query outside of this sub query. So how can I pass the sub query the ID of the tshirt I am checking?
Thank you.