I've found various examples of answers to questions very similar to mine. For some reason I can not get my query to work though.
What am I doing wrong?
I want to have the top 5 results returned with all other rows shown in the last row as "others".
Here is my SQL Syntax:
SELECT TOP 5 tbl_MopoRohdaten.rating_clir, Sum(tbl_MopoRohdaten.c2_eop_weight) AS SumOfc2_eop_weight
FROM tbl_MopoRohdaten
WHERE tbl_MopoRohdaten.rating_clir
NOT IN
(EXISTS(SELECT TOP 5 tbl_MopoRohdaten.rating_clir, Sum(tbl_MopoRohdaten.c2_eop_weight) AS SumOfc2_eop_weight FROM tbl_MopoRohdaten))
GROUP BY tbl_MopoRohdaten.rating_clir;
When I run it I get an error statement telling me:
You tried to execute a query that does not include the specified expression 'rating_clir' as part of an aggregate function.
UPDATE:
I've adjusted the code to reflect Balnian's input, but now Access (the entire application) simply shuts down and crashes whenever I try to run it!
SELECT TOP 5 tbl_MopoRohdaten.rating_clir, Sum(tbl_MopoRohdaten.c2_eop_weight) AS SumOfc2_eop_weight
FROM tbl_MopoRohdaten
WHERE tbl_MopoRohdaten.rating_clir
NOT IN
(EXISTS(SELECT TOP 5 tbl_MopoRohdaten.rating_clir,Sum(tbl_MopoRohdaten.c2_eop_weight) AS SumOfc2_eop_weight
FROM tbl_MopoRohdaten GROUP BY y tbl_MopoRohdaten.rating_clir))
GROUP BY tbl_MopoRohdaten.rating_clir;