SQL for applying conditions to multiple rows in a join

前端 未结 11 2048
一个人的身影
一个人的身影 2020-11-29 22:55

I think I found the answer to my question, I\'m just unsure of the syntax, I keep getting SQL errors.

Basically, I want to do the opposite of IN. Take this example:<

11条回答
  •  日久生厌
    2020-11-29 23:20

    You'll want to join the tags table again.

    SELECT * FROM users
    INNER JOIN tags as t1 on t1.user_id = users.id and t1.name='tag1'
    INNER JOIN tags as t2 on t2.user_id = users.id and t2.name='tag2'
    

提交回复
热议问题