SQL join on multiple columns in same tables October 25, 2022 by Tarik You need to replace the second ON with AND, like this: ON a.userid = b.sourceid AND a.listid = b.destinationid;