下面的SQL查询是由'用户'字段上升,但正如您从下表中看到的那样,它并不完全正常。查询肯定会导致我以不同的顺序获取记录,但它显然不按字母顺序排序。如果我对DESC进行排序,会发生类似的结果。许多名字开头于' T'夹在一对名字开头的V' V'例如。
4 Execute select `laptops`.`id`, `laptops`.`asset_tag`, `laptops`.`serial`, `laptops`.`hostname`,
`locations`.`location`, `laptops`.`user`, `laptops`.`detected_user`, `laptops`.`recent_users`,
`models`.`model`, `models`.`vendor`, `types`.`type`, `statuses`.`status` from `laptops`
inner join `locations` on `locations`.`id` = `laptops`.`location_id`
left join `locations` as `detected_location` on `locations`.`id` = `laptops`.`detected_location_id`
inner join `models` on `models`.`id` = `laptops`.`model_id`
inner join `types` on `types`.`id` = `models`.`type`
left join `statuses` on `statuses`.`id` = `laptops`.`status`
where `laptops`.`scrapped` != 1
order by ISNULL(user), user asc
limit 50 offset 0