I need to get the top 10 results in my table and their respective percentages, separating by groups. For example the table:
+-----+-----+
|id |fruit|
+-----+-----+
| 1 | or |
| 2 | ban |
| 3 | or |
| 4 | or |
+-----+-----+
It would have to return something like:
+-----+-----+-----+
|COUNT|fruit|PERCE|
+-----+-----+-----+
| 3 | or | 90% |
| 1 | ban | 10% |
+-----+-----+-----+
90% why it represents 90% of all rows and so goes