Skip to content
Advertisement

Tag: google-bigquery

Convert day of year & year to date Big Query

I have some data which instead of having a date field, contains the day of the year as a number and the year as a number in different columns. I have tried using big query functionality PARSE_DATE to achieve this by using PARSE_DATE(“%Y %j”, “2020 258”) but this does not work. When checking the docs https://cloud.google.com/bigquery/docs/reference/standard-sql/date_functions#parse_date %j is not supported

Parse out Y-M-D from Y-M-D H-M-S UTC sql bigquery

I need to parse out ‘%Y%m%d’ from the column in BigQuery. My data looks like this: I have tried the following: The error message: No matching signature for function PARSE_DATE for argument types: STRING, TIMESTAMP. Supported signature: PARSE_DATE(STRING, STRING) Desired output: 2000-09-25 Answer Why not just convert to a date? Note: This works for both datetime and timestamp values. These

BigQuery SQL conditional IN

I have been trying to construct a conditional IN like below, but this gives me the scalar subquery produced more than one element error. How should I approach this type of query instead? The tables are not related. Answer Try this below- As your other tables are not related, you can try this below logic-

Advertisement