尝试将以下查询转换为使用JOIN而不成功:
select * from usrdata
where recordid=any(select usrdataid from usrclix
where clidataid=any(select recordid from clidata
where subdataid='dd87cb0c-e571-11e6-b2b8-d4ae52cc00a8'));
我已经尝试过LEFT JOINS,JOINS等,但是我无法获得正确的结果集。有人可以帮助我使用JOINS正确编写此语句吗?谢谢。
最佳答案
检查这个
SELECT *
FROM userdata u
LEFT JOIN usrclix uc ON u.recordid = uc.userdataid
LEFT JOIN (SELECT recordid FROM clidata WHERE subdataid = 'dd87cb0c-e571-11e6-b2b8-d4ae52cc00a8') as cd ON c.clidataid = cd.recordid;
关于mysql - 将SQL查询格式化为适当的JOIN,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/42250684/