1

I have an array of structs in bigquery. I would like to return an array of structs, but the struct of the array with less fields that the original struct.

Example:

enter image description here

I would like to have the same results but without Skills.Id.

I tried to do something like this but

  SELECT  [(select struct(dd.Level as Level, dd.TypeId as typeid)
                  from unnest(dd.Skills) as dd  )]  as skills    
   FROM tablee dd

But get an exception:

Scalar subquery produced more than one element

1 Answer 1

5

Try ARRAY instead of []:

SELECT ARRAY(select struct(dd.Level as Level, dd.TypeId as typeid) 
             from unnest(tablee.Skills) as dd) as skills    
FROM tablee
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.