Skip to content
Advertisement

Mysql – how to do this sql

I have a “reviews” table with N records with 3 fields.

Field ID, field name and score field.

What I am trying to do is a query that returns me a grouping by the “score” field but with values ​​between sections.

In other words, I want to group the records with a score from 0 to 1 … records with a score from 1 to 2 … and so on up to 5.

Now , i’m doing it with 5 different sql like this

JavaScript

Advertisement

Answer

If I understand correctly, you are looking for something like below. If you need you can add other columns as well in GROUP BY.

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement