Search
 
SCRIPT & CODE EXAMPLE
 

SQL

big query get distinct array of objects

#Declare the function once
#standardSQL
CREATE TEMP FUNCTION dedup(val ANY TYPE) AS ((
  SELECT ARRAY_AGG(t)
  FROM (SELECT DISTINCT * FROM UNNEST(val) v) t
));
Comment

big query get distinct array of objects

SELECT * REPLACE(
  dedup(country) AS country,
  dedup(product) AS product
)
FROM `project.dataset.table`
Comment

PREVIOUS NEXT
Code Example
Sql :: power bi dax add related shows column but not working 
Sql :: sql server 2012 create or alter procedure 
Sql :: how change the field place in mysql 
Sql :: mariadb datetime change to microseconds 
Sql :: drop check command 
Sql :: how to reset id column in sql server 
Sql :: mybatis batch update oracle 
Sql :: phone number data type in sql 
Sql :: best practive to pass multiple table to stored procedure in sql server 
Sql :: How to Group by and concatenate arrays with all columns in PostgreSQL 
Sql :: datatype for phone number in sql 
Sql :: ! Wildcard in SQL 
Sql :: sql datediff db2 
Sql :: sql interview questions 
Sql :: SQL server datetime compare 
Sql :: psql database does not exist 
Sql :: selecting names ending with vowels in sql 
Sql :: print pl sql 
Sql :: sql int size 
Sql :: difference berween database and data base management system 
Sql :: how to add column sql 
Csharp :: unity scene change 
Csharp :: unity cycle children 
Csharp :: unity how to get y value 
Csharp :: ALWAYS MAximize window on start c# 
Csharp :: c# store strings in file 
Csharp :: orderby c# randomize 
Csharp :: c# get full URL of page 
Csharp :: how to do a foreach loop in c# for dictionary 
Csharp :: add two numbers in c# 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =