I want to extract the hour of the day from the created_at timestamp (line 3) in the second column via Big Query SQL. With my current code I get the error: "Encountered " "FROM" "FROM "" at line 3, column 18. Was expecting: ")" ..."
Current code:
SELECT date(created_at) as date, EXTRACT(HOUR FROM created_at) AS hour, sum(net_revenue) as net_revenue, count(order_unique_id) as orders FROM [source] WHERE DATE(created_at) BETWEEN DATE(DATE_ADD(CURRENT_DATE(), -2, 'DAY')) AND CURRENT_DATE() GROUP BY 1,2
Thanks in advance for helping!
The only error I see in your query is in the WHERE clause. Presumably you intend:
WHERE
WHERE DATE(created_at) BETWEEN DATE_ADD(CURRENT_DATE(), INTERVAL -2 DAY') AND CURRENT_DATE()
2.1m questions
2.1m answers
60 comments
57.0k users