Like mentioned in the comments by @JNevill
, your query is mostly correct, you just need to use the data
in the select like so and set the correct index in where
clause
f.value:data::STRING
Sample query
SELECT
party_id,
f.value:data::STRING AS phone_number_new,
-- f.value::STRING as phone_number
FROM
main_parties,
LATERAL FLATTEN(input => party_phones) f
WHERE
f.index = 1;
Returns
or a filter with f.value:phoneType = 0
also works