Advertisements
I have a BigQuery table like below
I want to return the rows whose col_1
, col_2
, and col_3
values are not the same.
In the example above, it should return the 2nd and 3rd row (with key ghj-ikl
and tgl-pkl
). All 3 columns have to have the same values.
How can I do that?
Thanks
>Solution :
Consider below approach (BigQuery Standard SQL)
select * from your_table
where (
select count(distinct el) > 1
from unnest([col_1, col_2, col_3]) el
)
if applied to sample data in your question – output is