How to Concatenate integers in BigQuery?

I.m.rich

I need to concatenate two strings, year and Quarter, which are structured like so: Year|Q

2007|1

2008|2

2005|4

I have tried the following code:

   update  `Project.MACRO.Table`  
set YearQuarter =  CAST(year as string) + '_' + CAST(quarter as string) 
where quarter is not null

it does not work as only INT64 + INT64; FLOAT64 + FLOAT64; NUMERIC + NUMERIC are supported signatures. I don't believe I can use group_concat as part of an update. Any suggestions?

Mikhail Berlyant

You can use CONCAT() function as below

CONCAT(CAST(year as STRING),'_',CAST(quarter as STRING))  

or you can use FORMAT() as below

FORMAT('%i_%i', year, quarter)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Concatenate two integers in Spring EL

How to concatenate two integers in Python?

How can I concatenate two variables, containing integers, with angularjs?

Concatenate the values of a nested field on BigQuery

BigQuery concatenate string and integer/timestamp?

Concatenate columns with specific width integers

C++ How do I concatenate literals with integers?

How to concatenate and group rows in large BigQuery table with "Resources exceeded" problems

how to concatenate two positive integers using macros?

How to concatenate strings, integers and floating point numbers without using objects?

Querying array of integers in BigQuery

Concatenate columns in alphabetic order in BigQuery

Concatenate strings in BigQuery

BigQuery - concatenate ignoring NULL

Numpy array: concatenate arrays and integers

How to concatenate vector of integers interleaving elements with a character?

How to concatenate four integers in one array in kernel?

Concatenate Integers without calculate PHP

How can I get integers from bigquery nodejs api?

concatenate two integers into a char * in C

UNION ALL or CONCATENATE Datasets in BigQuery

How can you write a template function to add integers but concatenate strings and char types?

How do I concatenate two arrays of different datatypes in BigQuery?

How to concatenate two integers in Kotlin?

In Google BigQuery SQL, how to concatenate rows of string for same person?

How to concatenate and print a list of integers?

bigquery transpose and concatenate for each record

How to consecutively concatenate a vector of integers in R

Combine/concatenate two arrays of integers