SQL query at least one of something

前端 未结 6 690
鱼传尺愫
鱼传尺愫 2021-02-01 07:33

I have a bunch of Users, each of whom has many Posts. Schema:

Users: id
Posts: user_id, rating

How do I find all Users who have at least one po

6条回答
  •  逝去的感伤
    2021-02-01 08:05

    Use an inner join:

    SELECT * from users INNER JOIN posts p on users.id = p.user_id where p.rating > 10;
    

提交回复
热议问题