search

Home  >  Q&A  >  body text

php - double sort troubles

Suppose there are two fields in the user table, one is the number of questions num, and the other is the time. Now we need to sort by num first, and then sort the same num by time.
For example (num has three numbers, 5, 7, 5, and then sorted by nun to get 5, 5, 7, but is there any way to sort the same two 5 and 5 by tine separately)

黄舟黄舟2819 days ago460

reply all(2)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-05-16 13:13:09

    order by num desc,time desc Isn’t this easy to do?

    reply
    0
  • 漂亮男人

    漂亮男人2017-05-16 13:13:09

    Database query can be solved by SQL. If it is only implemented in PHP, you can take a look at thisarray_multisort

    reply
    0
  • Cancelreply