Shantanu Jain
Shantanu Jain

Reputation: 87

Unable to select a column in BigQuery

I am unable to select a column named: event_params.value.string_value

Here's my code:

SELECT
  DISTINCT (event_params.value.string_value)
FROM
  `data-22.events_20200914`

My error:

Cannot access field value on a value with type ARRAY<STRUCT<key STRING, value STRUCT<string_value STRING, int_value INT64, float_value FLOAT64, ...>>> at [2:26]

Upvotes: 1

Views: 1192

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1271003

Presumably you want:

SELECT DISTINCT event_param.value.string_value
FROM `mybits-54f8c.analytics_179636122.events_20200914 a CROSS JOIN
     UNNEST(event_params) event_param;

But this is just a guess.

Upvotes: 2

Related Questions