Mysql Filter with ORDER BY

Asked

Viewed 82 times

0

I have a line to filter some values:

Level Exp Kills playtime

if (
  $cron_6 = mysqli_query(server_player(),
    "SELECT 
       player.id,
       player.name,
       player.level, 
       player.job,
       player_index.empire,
       player.exp,
     IF NULL(player.quantidade,0) 
       as 
         kills, 
         player.quantidade 
     FROM 
         player 
     LEFT JOIN 
         player_index 
     ON 
         player_index.id = player.account_id 
     LEFT JOIN 
         kill_system 
     ON 
         player.id = kill_system.id 
     WHERE 
         player.name 
           NOT LIKE 
             '[%]%' 
           OR 
             player.name 
           LIKE 
             '%[VIP]%' 
     ORDER BY 
         player.level 
           DESC, 
         quantidade 
           DESC, 
         player.playtime 
           DESC, 
         player.exp 
           DESC
      ;"
    )
  );

In case the value would be (ranking):

top Kill (who has more Kill)

top level (who has more level)

top Exp (who has the most Exp)

top playtime (who has more time)

My site with the ranking: https://sowmt2.org/site/ranking/players

In case who has +Kill should stay first.

1 answer

0

Only add Kills to order by. SQL ORDER BY Keyword

The way you wrote it, it would look like this:

ORDER BY kills DESC, player.level DESC, player.exp DESC

  • As incredible as it seems I’ve done it yet the data "Kills" do not get sorted.

  • in case the quantity DESC, already represents the Kills understood.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.