我尝试执行我的SQL查询,但似乎有问题,任何人都可以更正。
SELECT * FROM (
(SELECT i.email AS internautemail, i.compteEMVclient, i.datecreation FROM internaute i INNER JOIN lead lap ON i.id=lap.idInternaute)
UNION
(SELECT v.email AS usermail, v.compteEMVclient, v.datecreation FROM V2_user v INNER JOIN v2_lead vlap ON v.id=vlap.idUser)
) AS t
WHERE i.compteEMVclient!=v.compteEMVclient
最佳答案
您必须这样做:
SELECT *
FROM (
(
SELECT i.email AS usermail, i.compteEMVclient, i.datecreation
FROM internaute i
INNER JOIN lead lap ON i.id=lap.idInternaute
INNER JOIN V2_user v ON i.compteEMVclient!=v.compteEMVclient
INNER JOIN v2_lead vlap ON v.id=vlap.idUser
)
UNION
(
SELECT v.email AS usermail, v.compteEMVclient, v.datecreation
FROM V2_user v
INNER JOIN v2_lead vlap ON v.id=vlap.idUser
INNER JOIN internaute i ON i.compteEMVclient!=v.compteEMVclient
INNER JOIN lead lap ON i.id=lap.idInternaute
)
) AS t