When you write an SQL query that uses an aggregate function like below,
SELECT product, sum(sales)
FROM product_sales
GROUP BY product
you might see the below error.
Syntax error: All expressions in a driver table must have an explicit name
To work around the error, please explicitly set a name for the derived column. i.e sum(sales) as total_sales like below.
SELECT product, sum(sales) as total_sales
FROM product_sales
GROUP BY product