Skip to content
Advertisement

PHP How to orderby two columns when the data is equal

This return come from this query.

JavaScript

Let`s understand my doubt, i have this data.

JavaScript

When i have the equal points data 0 is 120 and data 1 is 120. I need to display the first data with less totalTime in this case needs to be like this :

JavaScript

Can i manage this only with SQL or i need to order with PHP ?

Advertisement

Answer

Use orderBy() as multiple times as you need:

JavaScript

or use orderByRaw() for multiple ordering:

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