Jump to content

Recommended Posts

I want use 2 order by in mysql query , and every thing in ok :

 

ORDER by level DESC , id ASC

 

my problem with level filed cause :

in result list I want Level = 2 is first and after it Level 3

 

but when I using level DESC show first level 3

if I use level ASC my list start from normal user! and level 1 (end to first)

Link to comment
https://forums.phpfreaks.com/topic/171928-use-2-order-by-for-list-data/
Share on other sites

Thanks keith

better I explain user level

 

i want sort online user and i used one  WHERE guest = '0'    (just reg users)

there is 3 Level :

level 2 : God Admin

level 3 : moderator

level 1 : normal user

 

I want sort  users online :

First : God Admin [level 2]

Two : moderator [level 3]

Tree : normal user [level 1]

 

My Query :

    $ListOnline = $db->sql_query("SELECT w.uname, w.module, w.url, u.user_id, u.user_level, u.user_allow_viewonline FROM Table_session AS w LEFT JOIN Table_users AS u ON u.username = w.uname WHERE guest = '0'  ORDER by user_level DESC, user_id ASC");

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.