I'm having an issue with my stored procedure.
I am getting error:
Cannot perform an aggregate function on an expression containing an aggregate or a subquery
Here's the part of my stored procedure where I believe the error occurs:
SELECT column_1, column_2,
SUM(CASE WHEN column_2 NOT IN (SELECT product FROM table_products) THEN 1
ELSE 0
END) AS Total
FROM my_table
WHERE is_rated = '1'
GROUP BY column_1, column_2
Thank you.
table_productsor one less than the number (or0ifproductis everNULL). You may want to ask another question with sample data and desired results. - Gordon Linoff