hi! I don't know what I'm doing wrong when implementing DATEBYPARTS, I get this error. The code is fine until then. Not much out there on what the error could mean, can anyone please help me make any sense?
Hey, it looks like you want to extract the year and month to get something like "2022-05-01", is that right?
Try replacing the DATEBYPARTS with BigQuery's DATE_TRUNC function. You may need to put the function in new CTE, like this:
, temp AS ( SELECT createdBy, min(Orders__createdAt) AS first_order_date FROM... ) SELECT createdBy, DATE_TRUNC(first_order_date, MONTH) FROM temp
I think DATEFROMPARTS is SQL Server function. The part of the error that says
/bigquery/ tells you that you're querying a BigQuery database, which uses a different syntax