How to ORDER BY with different columns as one column?

后端 未结 2 360
温柔的废话
温柔的废话 2021-01-26 03:08

I\'ve got the following code below:

$db = $this->database[GDB];
$num_rows = $db->doQuery(\'SELECT TOP 100 strUserId, TotalTime, Nation, LoginDT FROM USERDA         


        
2条回答
  •  野性不改
    2021-01-26 03:56

    Have you tried

    SELECT TOP 100 strUserId, TotalTime + (time() + 7200 - LoginDT) as
    newTotalTime, Nation, LoginDT FROM USERDATA WHERE Authority IN(1, 2)
    ORDER BY newTotalTime DESC
    

提交回复
热议问题