可能重复,但对这种情况没有提供任何见解: 无法绑定多部分标识符
我有以下形式的查询:
select l.id, l.foo, r.id, r.foo
from tbl l
inner join storyevents r on l.id = r.id
right join (
select distinct foo from tbl where id= l.id
) tmp on l.foo = tmp.foo
where l.foo = 12345
但我收到以下错误:
The multi-part identifier "l.id" could not be bound.
关于right join
子查询。
加分项:这是尝试从inner join
基于单个列中删除重复行。更好的方法来做到这一点?