I am writing a simple program using a database I've created but I have run into an issue, I am trying to determine the highest occurring referrer ID while also displaying the customer information
SELECT TOP (3) referrer_id,
COUNT(referrer_id) AS value_occurance,
customer_id,
CONCAT(first_name, ' ', last_name) AS full_name
FROM customer
GROUP BY referrer_id
ORDER BY value_occurance DESC
This is my query.
Column 'customer.customer_id' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
This is the error I am receiving.