i have data single column of , array of ids not in json format.
"100,101,102"
i able query rows like
where "101" in idarray
but appears array type not supported column type.
is there approach in bigquery array or delimited string can queried containing element?
for example in postgresql can use array contains element syntax @>
select * ( select idarray (select "100,101,102" idarray), (select "200,201,202,1010" idarray), ) yourtable "," + idarray + "," contains "," + "101" + ","
same above "adopted" bigquery standard sql
with yourtable ( select "100,101,102" idarray union select "200,201,202,1010" idarray ) select * yourtable concat(",", idarray, ",") concat("%,", "101", ",%")
or
with yourtable ( select "100,101,102" idarray union select "200,201,202,1010" idarray ) select * yourtable regexp_contains(idarray, r"\b101\b")
or ("pure" standard sql style)
with yourtable ( select "100,101,102" idarray union select "200,201,202,1010" idarray ) select idarray yourtable, unnest(split(idarray)) id1 id1 = "101"
Comments
Post a Comment