1

The following is my query:

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;

Here I have tried using nested groups with Alias name for Table1.

And while executing this query I get the Following error in PostGres:

ERROR: schema "t1" does not exist
SQL state: 3F000

I feel that the error might be due to the alias name 't1' used incorrectly for nested groups in Json.

Please help me make this query work.

Mike Sherrill 'Cat Recall'
  • 91,602
  • 17
  • 122
  • 185
Mufaddal
  • 558
  • 5
  • 24

0 Answers0