I need SQL query for grouping by some category which would present quantities of only those groups which in total contain at least 80% of all categories, other rare categories (containing up to 20% of total) should be represented like "other".
So the result of such a query for grouping apples by category color should look like this:
RED 1118 44% )
YELLOW 711 28% > at least 80%
GREEN 229 9% )
other 482 19%
How to do that?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…