I have a DB collection with multiple JSON elements. I am trying to open each element to gather the info at the end point and then combine all the end point information.
Currently my plan is to use this:
Create Table P1S1C1 as
select title,
path,
user,
userP,
active,
created,
updated,
pro::json#\>\>'{0,s,0,c,0,signup}' as "signup",
pro::json#\>\>'{0,s,0,c,0,finish}' as "finish",
pro::json#\>\>'{0,s,0,c,0,cost}' as "cost",
pro::json#\>\>'{0,s,0,c,0,status}' as "status",
pro::json#\>\>'{0,s,0,c,0,startat}' as "startat"
from db_st
However, each 0 in the query has multiple elements to open (first one (p) is 0,1/second one (s) is 0-44/third one (c) is 0-16). Example of the second query to open the next element in the first element:
Create Table P1S2C1 as
select title,
path,
user,
userP,
active,
created,
updated,
pro::json#\>\>'{0,s,1,c,0,signup}' as "signup",
pro::json#\>\>'{0,s,1,c,0,finish}' as "finish",
pro::json#\>\>'{0,s,1,c,0,cost}' as "cost",
pro::json#\>\>'{0,s,1,c,0,status}' as "status",
pro::json#\>\>'{0,s,1,c,0,startat}' as "startat"
from db_st
The only way I can think of is too do a table for each of these and join them but that would be 1408 tables!!
There has to be a better way. How can I do this faster?
procolumn, and the desired result?db_st? Sounds like you rather want aVIEW.json_array_elementsthen (possibly nested)