1

所以我有这个查询:

select 
   id, 
   unnest(suppliers) as suppliercode
from table1 t1
left join table2 t2
on t1.suppliercode = t2.suppliercode

Postgres 无法理解是什么意思:

on t1.suppliercode = t2.suppliercode

t2.suppliercode引起混乱。为什么?您如何显式调用新的派生列?

4

1 回答 1

1

t1.suppliercode意思是“suppliercode表中的列t1”。而且你的桌子t1没有这样的列。

尝试类似:

select *
from(select t1.id, 
            unnest(t1.suppliers) as suppliercode
     from table1 t1 ) sub
left join table2 t2
on sub.suppliercode = t2.suppliercode
于 2013-06-12T10:10:17.197 回答