I am relatively new to SQL...
I am creating a summary of returned items and I would like the finished result to show the item code, the amount returned (SUM) and the reason for return. So Ideally it would be something like this:
101 - Blue Widget | 13 | Shipment Lost
101 - Blue Widget | 3 | Damaged in Transit
102 - Red Widget | 5 | Shipment Lost
So it is grouping by ITEM and RMACODE and summing the quantities
Here is a simplified version of the query I wrote for this
Select ITEM, SUM(QUANTITY), RMACODE, DATEENTERED
FROM RMAITEMS
group by ITEM, Quantity, RMACODE
I am loading this in SSRS and need DATENETERED for my report parameters to only pull records between @StartDate and @EndDate. I get en error saying DATEENTERED is invalid because it is not in the GROUP BY.
Is there a better/different way to acheive the result I am looking for?
Thanks
Andrew
I made the changes suggested by edkloczko and it appeared everything would work then, but since we removed the date from the select statement I am unable to use it in my report parameters. Here is a screenshot. I have a few ideas I will try out today but if anyone has already climbed this hill and can help me with directions I would be grateful.