I've looked at example after example, and I cannot find the syntax for what I need to do. With the below jsonb data, can someone tell me how to query the lastUpdatedTimestamp?
{
"name": "Company name",
"professionalData": [{
"unit": "unit 1",
"id": "1228",
"school": "University of California-Berkeley, Haas School of Business",
"quarter": "Q1",
"lastUpdatedTimestamp": "2020-10-27T18:05:00Z"
},
{
"unit": "unit 2",
"id": "1228",
"school": "University of California-Berkeley, Haas School of Business",
"quarter": "Q1",
"lastUpdatedTimestamp": "2020-10-29T12:10:00Z"
}
]
}
I can get the professionalData object, but how do I then get an element within the array nested in professionalData? This is my exact query:
SELECT
elements
FROM product_reference_master p,
jsonb_array_elements(p.prd_ref_dta_mas_json->'professionalData') as elements
And I get an error: ERROR: cannot extract elements from an object
I'm using Postgresql Aurora in AWS. I'm unsure of the exact version...