Here's my code:
SELECT
COUNT(customer_id) AS id_count,
purchase_price,
purchase_size
FROM
charjx-project-twenty-three.customer_data1.customer_purchase
WHERE
purchase_size > 1
ORDER BY
purchase_size
Error message is:
SELECT list expression references column purchase_price which is neither grouped nor aggregated at [3:3]
I'm super new to SQL. So I'm learning the Ins and outs, especially with errors.
As you are using aggregate function
COUNT, other columns must be in theGROUP BYclause so that aggregate function can provide you the aggregated result based on the grouped columns.You just need to include
GROUP BYas follows: