MySQL select specific entry from a table which is not in another table

后端 未结 3 679
旧巷少年郎
旧巷少年郎 2021-01-21 12:15

I have a problem in MySQL when trying to select specific entry from table which is not in another table. I know this sentence sounds nuts but here is an example what I am trying

3条回答
  •  有刺的猬
    2021-01-21 12:43

    Try this:

    SELECT user_id
    FROM users
    WHERE user_id NOT IN (
      SELECT user_id
      FROM views
      WHERE article_id = 10
    )
    

提交回复
热议问题