You need to replace the second ON
with AND
, like this:
ON a.userid = b.sourceid AND a.listid = b.destinationid;
More Related Contents:
- What is the result of following SQL Query?
- How to display data in JOIN, and return null value? [closed]
- How can I do a FULL OUTER JOIN in MySQL?
- Join vs. sub-query
- SQL JOIN – WHERE clause vs. ON clause
- Can I use CASE statement in a JOIN condition?
- What is the difference between Left, Right, Outer and Inner Joins? [duplicate]
- Why isn’t SQL ANSI-92 standard better adopted over ANSI-89?
- Subqueries vs joins
- SQL to LINQ with multiple join, count and left join
- Difference between left join and right join in SQL Server [duplicate]
- Multiple INNER JOIN SQL ACCESS
- Oracle “(+)” Operator
- JOIN two SELECT statement results
- SQL Join Differences
- Implement paging (skip / take) functionality with this query
- Difference between natural join and inner join
- Is there something wrong with joins that don’t use the JOIN keyword in SQL or MySQL?
- Mixing implicit and explicit JOINs
- Why does this SQL code give error 1066 (Not unique table/alias: ‘user’)?
- Is a JOIN faster than a WHERE?
- Is it true that using INNER JOIN after any OUTER JOIN will essentially invalidate the effects of OUTER JOIN?
- Difference between RIGHT & LEFT JOIN vs RIGHT & LEFT OUTER JOIN in SQL [duplicate]
- Merge two rows in SQL
- How to exclude rows that don’t join with another table?
- Left Join without duplicate rows from left table
- Is NATURAL (JOIN) considered harmful in production environment?
- SQL select join: is it possible to prefix all columns as ‘prefix.*’?
- Removing duplicate rows (based on values from multiple columns) from SQL table
- sql query joins multiple tables – too slow (8 tables)