How to put row on top in mysql query.

后端 未结 4 1603
旧巷少年郎
旧巷少年郎 2021-02-14 12:33

Hi i have 100 records in my SQL table i want to sort them ASC by name but i need one record on top of all record nr 43.

Is there way i can pull this record 43 first and

4条回答
  •  庸人自扰
    2021-02-14 12:38

    Use a union to create a query that selects the first record then appends the set of records that should appear beneath.

    E.g:

    select * from table where id = 43;
    union
    select * from table where id <> 43;
    

提交回复
热议问题