我有 2 个子查询,但我无法将同一个表中的列连接在一起。我试过了:
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
?
任何帮助表示赞赏。