Sql 有效内部联接请求中缺少from子句
我有这个:Sql 有效内部联接请求中缺少from子句,sql,postgresql,Sql,Postgresql,我有这个: SELECT tbl1.* as tbl1 from table1 inner join table2 as tbl2 on tbl1.id = tbl2.table1_id where tbl2.something = xxx; 为什么会抛出异常 ERROR: missing FROM-clause entry for table "tbl1" LINE 3: on tbl1.id = tbl2.table1_id ^ 在第一行中,您将表1中的作为tbl
SELECT tbl1.* as tbl1 from table1
inner join table2 as tbl2
on tbl1.id = tbl2.table1_id
where tbl2.something = xxx;
为什么会抛出异常
ERROR: missing FROM-clause entry for table "tbl1"
LINE 3: on tbl1.id = tbl2.table1_id
^
在第一行中,您将表1中的
作为tbl1
和按错误的顺序排列
应该是:
select tbl1.*
from table1 as tbl1
inner join table2 as tbl2
on tbl1.id = tbl2.table1_id
where tbl2.something = xxx;
在第一行中,您将表1中的作为tbl1
和按错误的顺序排列
应该是:
select tbl1.*
from table1 as tbl1
inner join table2 as tbl2
on tbl1.id = tbl2.table1_id
where tbl2.something = xxx;