由于某种原因,我无法将表别名t
分配给FROM
子句中的第一组表。我想将此t
和LEFT JOIN
称为另一组表。为什么我不能这样做?
select
job.job
from
(job
inner join
item on job.item = item.item
inner join
jobroute as jb on job.job = jb.job and job.suffix = jb.suffix) as t --the error message points to this line
left join
(select
jb.job, jb.suffix,
sn.notecontent
from
SpecificNotes as sn
join
ObjectNotes as onn on onn.SpecificNoteToken = sn.SpecificNoteToken
join
jobroute as jb on jb.RowPointer = onn.RefRowPointer) as x on t.job = x.job and t.suffix = x.suffix
答案 0 :(得分:0)
我认为只要删除as
关键字就行了。
答案 1 :(得分:0)
括号仅用于对连接进行分组。您不会创建其他别名。
它们通常是不必要的。所以,删除它们:
outerline.beginPath();
您可能有点困惑,因为括号也用于子查询,而这些需要表别名。但是,仅仅对联接进行分组并不是别名的机会。
您还会注意到我删除了select j.job
from job j join
item i
on j.item = i.item join
jobroute jr
on j.job = jr.job and j.suffix = jr.suffix left join
(select jb.job, jb.suffix, sn.notecontent
from SpecificNotes sn join
ObjectNotes onn
on onn.SpecificNoteToken = sn.SpecificNoteToken join
jobroute jr
on jr.RowPointer = onn.RefRowPointer
) x
on t.job = j.job and t.suffix = j.suffix;
。这是个人偏好。我发现as
只会使as
条款变得混乱,但它完全可以接受。
答案 2 :(得分:0)
试试这个:
select
job.job
from
(select
job
from
job
inner join
item on job.item = item.item
inner join
jobroute as jb on job.job = jb.job and job.suffix = jb.suffix) as t --the error message points to this line
left join
(select
jb.job, jb.suffix,
sn.notecontent
from
SpecificNotes as sn
join
ObjectNotes as onn on onn.SpecificNoteToken = sn.SpecificNoteToken
join
jobroute as jb on jb.RowPointer = onn.RefRowPointer) as x on t.job = x.job and t.suffix = x.suffix