What kind of join do I need?

后端 未结 4 996
走了就别回头了
走了就别回头了 2020-11-27 23:01

I have a votes table:

 votes
-----------------
 userid   gameid
-------  --------
   a        1
   a        2
   a        3
   b        1
   b        2
         


        
4条回答
  •  粉色の甜心
    2020-11-27 23:58

    You would use an INNER join to establish the relationship between the common gameid field;

    select
      votes.userid,
      games.title
    from games
      inner join votes on (votes.gameid = game.gameid)
    where
      votes.userid = 'a'
    

提交回复
热议问题