您好我正在尝试通过Full Outer连接两个表来访问,因为我想保留所有项目。
这是我的代码:
SELECT aa.*, bb.firstname, bb.lastname, bb.totalcost
FROM (select IT.*,HR.*from IT
left join HR on HR.firstname=it.firstname and HR.lastname=IT.lastname)
AS
aa FULL OUTER JOIN 2016totalcost AS bb ON (bb.lastname=aa.IT.lastname)
AND (bb.firstname=aa.IT.firstname);
但是我从from子句
中得到了错误语法错误感谢您的帮助
答案 0 :(得分:0)
注意:当我回答时,问题标记为Oracle。
Oracle语法为:
select IT.*, HR.*, bb.firstname, bb.lastname, bb.totalcost
from IT left join
HR
on HR.firstname = it.firstname and HR.lastname = IT.lastname full outer join
2016totalcost tc
on tc.lastname = it.lastname and tc.firstname = it.firstname;
答案 1 :(得分:0)
答案 2 :(得分:0)
进行LEFT JOIN并将其联合起来加入:
SELECT
*
FROM
Table1
LEFT JOIN
Table 2
ON
Table1.joincolumn = Table2.joincolumn
UNION
SELECT
*
FROM
Table1
RIGHT JOIN
Table 2
ON
Table1.joincolumn = Table2.joincolumn