'MySQL Group Per OrderBy

I have a data like this. I want to sort this data with a different ProviderId for each row.

Table1
ProviderId   Tags
1            home
2            phone
3            notebook
3            phone
2            ...
2            ...
1            ...
1            ...

Below I am attaching an example of what I want to do.

Table1
ProviderId   Tags
1            ...
2            ...
3            ...
1            ...
2            ...
3            ...


Solution 1:[1]

To do this, you have to use Group by for both columns and then Order by ProviderId just like this:

SELECT * FROM table1 GROUP by ProviderId, tags ORDER by ProviderId; 

Local Result

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 AwatITWork