我收到的错误可以简化为:
create view test as
select *
from
firsttable f
inner
join ( select *
, row_number() as rownum
from
secondtable s
) as t
on f.id = t.id
错误是派生表t的内容,第一个索引没有名称。我做错了什么?
答案 0 :(得分:0)
使用它。请注意s.
的选择查询中*
之前的secondtable
。
同样使用列名及其相应的别名,就好像两个表都是2个具有相同名称的列一样,那么你可能会得到错误。
create view test as
select f.id as id1,f.col1 as col1,f.col2 as col2 ......
t.id as id2,t.col1 as tcol1,t.col2 as tcol2 .....
from
firsttable f
inner
join ( select s.*
, row_number() as rownum
from
secondtable s
) as t
on f.id = t.id