79431108

Date: 2025-02-11 19:19:32
Score: 0.5
Natty:
Report link

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

enter image description here

or a filter with f.value:phoneType = 0 also works

enter image description here

Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
  • User mentioned (1): @JNevill
  • High reputation (-1):
Posted by: samhita