以下是我的疑问:
select t1.id,
sum(
((t1.json->'group_te3dx03/group_tb3th42'->>1)::t1.json->>'group_te3dx03/group_tb3th42/number_of_seats_allotted_to_wo')::int +
((t1.json->'group_te3dx03/group_tb3th42'->>1)::t1.json->>'group_te3dx03/group_tb3th42/number_of_seats_allotted_to_me')::int
)as number_of_seats
FROM table1 as t1 , table2 as t2
WHERE t1.xform_id = t2.id;
在这里,我尝试使用具有Table1的别名的嵌套组。
执行此查询时,我在PostGres中收到以下错误:
ERROR: schema "t1" does not exist
SQL state: 3F000
我觉得错误可能是由于别名“t1”错误地用于Json中的嵌套组。
请帮助我进行此查询。