SQL join on multiple columns in same tables

后端 未结 2 1183
再見小時候
再見小時候 2020-12-07 14:17

I have 2 subqueries, but I\'m having trouble joining columns together from the same tables. I tried:

SELECT * FROM

(SELECT userid, listid 
FROM user_views_         


        
相关标签:
2条回答
  • 2020-12-07 14:43

    Join like this:

    ON a.userid = b.sourceid AND a.listid = b.destinationid;
    
    0 讨论(0)
  • 2020-12-07 15:09

    You want to join on condition 1 AND condition 2, so simply use the AND keyword as below

    ON a.userid = b.sourceid AND a.listid = b.destinationid;
    
    0 讨论(0)
提交回复
热议问题