There is a table simplified with the following fields: id, status, date .
You must select all fields with status = new at the beginning, and sort all remaining fields by date . If possible, a solution is desirable through the ORDER BY construct.

  • four
    ORDER BY status='new' DESC, date - Akina
  • @Akina Why didn’t they answer the answer? Need to fix. - AK

1 answer 1

You can list the fields and sort order in ORDER BY :

 ORDER BY status = 'new' DESC, /* отсортирует по флагу */ date /* следом отсортирует по дате */