I table words with fields: rating and occurrence.
TABLE: words
+----+----------+----------------+
| id |occurrence| rating |
+----+----------+----------------+
| 1 | 0.2 | 2 |
| 2 | 0.1 | 1 |
| 3 | 0.5 | 3 |
+----+----------+----------------+
Rating It’s a index of ordered by occurrence (asc) column.
So firstly I have to sort all records, and then for every record set index in rating column. How to do it in SQL ?
1 Answer