Rumah > Soal Jawab > teks badan
P粉9669797652023-08-16 10:29:05
Untuk menukar fungsi JSON
列转换为STRING
,您可以使用JSON_EXTRACT_SCALAR
. Contoh:
WITH sample AS ( SELECT JSON '[{"day_of_week": "SUNDAY", "from": "06:00:00", "to": "15:00:00"}]' as json_data ) SELECT JSON_EXTRACT_SCALAR(j.day_of_week) as day_of_week, JSON_EXTRACT_SCALAR(j.from) as `from`, JSON_EXTRACT_SCALAR(j.to) as `to` FROM sample, UNNEST(JSON_EXTRACT_ARRAY(sample.json_data)) j