Here is the query I am running
SELECT
EXTRACT(YEAR FROM CAST(Date AS Date)) AS Year,
EXTRACT(MONTH FROM CAST(Date AS Date)) AS Month,
ProductId,
ROUND(MAX(UnitPrice),2) AS UnitPrice,
SUM(Quantity) AS UnitsSold
FROM `mineral-anchor-426102-d8.sales.sales_info`
GROUP BY
Year,
Month,
ProductId
ORDER BY Year, Month, ProductId;
Data Preview
Here is an details of the data
I have tried using DATE_FORMAT and still got this error. Is there anything I am missing?
New contributor
Muhaimin Ahmed is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.