以下は私の質問です:
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
エラーは、Json のネストされたグループに誤って使用されたエイリアス名 't1' が原因である可能性があると感じています。
このクエリを機能させるのを手伝ってください。