Stored Procedure Error

How do you past the GROUP BY error without listing all of the columns in a stored procedure Column OPERATOR is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause. Then I add the Column and it ask for the next one and so on. It keeps stopping on every one and I have to keep adding them and there are 22 of them. It wants me to add all of them to the group by why? All I want to Group by is Operator, Unique ID and Date? Thanks in advance

Please post sample tables and sample data and result u want to see

1 Like

Resolved thank you

It would be nice if you showed us how you resolved it. Thanks.

1 Like

Sorry I added a DateDiff Column to correct the error

% 7 = 0 THEN - 4 ELSE - 2 END, CAST(GETDATE() AS date))) AND (dp.D_DATE < DATEADD(DAY, - 1, CAST(GETDATE() AS date)))