我想自我联接到一个表上,然后将其联接到第三个表...下面是我的尝试,但是在第4行“ a.employee_t.employeeid”上出现904错误。这可能吗?我会使用什么语法?
SELECT a.employeename, b.employeename
FROM employee_t a, employee_t b
JOIN employeeskills_t ON
a.employee_t.employeeid=employeeskills_t.employeeid;
编辑:在发布此消息之前,我应该有所犹豫,因为我的代码是 非常荒谬...我将在下面以正确的语法发布(无904错误)
SELECT a.employeename, b.employeename, employeeskills_t.skillid
FROM employee_t a
JOIN employee_t b ON a.employeeid=b.employeeid
JOIN employeeskills_t ON a.employeeid=employeeskills_t.employeeid;
我正在使用Oracle数据库12.2.0.1.0
答案 0 :(得分:3)
这里有些猜测。也许这就是您想要的?我假设您想扩展此查询,它现在没有太多意义。
SELECT a.employeename, b.employeename
FROM employee_t a
JOIN employee_t b on a.employeeid= b.employeeid
JOIN employeeskills_t c ON a.employeeid=c.employeeid;
答案 1 :(得分:0)
否,您不能使用其他语法。 employee_t a,employee_t b必须通过JOIN加入
答案 2 :(得分:0)
您的查询应该是这样的:
SELECT a.employeename, b.employeename
FROM employee_t a
JOIN employee_t b ON
b.employeeid = a.employeeid (YOUR JOIN CONDITION)
JOIN employeeskills_t ON
employeeskills_t.employeeid = a.employeeid;
请注意,我更改了连接条件a.employee_t.employeeid=employeeskills_t.employeeid
,因为您使用了表别名和表名。