我有两个子查询,但是我无法将同一个表中的列连接在一起:
SELECT * FROM
(SELECT userid, listid
FROM user_views_table
WHERE date='2013-05-15' AND view_type='lists') a
JOIN
(SELECT sourceid, destinationid
FROM actions_table
WHERE date='2013-05-15' AND payloadtype='lists_user' AND actiontype='delete') b
ON a.userid = b.sourceid
ON a.listid = b.destinationid;
如果我简单地用 ON a.userid = b.sourceid
结束查询,那么它就可以工作,但是我如何将这些表连接到另一个也是 ON a.listid = b.destinationid
的列上呢?
感谢你的帮助。