我有一个案例,我必须按品牌对表中的结果进行分组,然后按其他列排序。
我从数组中获取我的品牌。问题是当我按品牌分组时,这个组是按 ID 排序的(组内)。有没有办法在组内排序(排序)?
这是我的数组和 mysql 查询。
$laptop_brands = array("Acer", "Apple", "Dell", "HP-Compaq", "IBM-Lenovo", "Sony", "Toshiba", "ASUS", "Fujitsu", "Gateway");
$get_videos_query = "SELECT * FROM users_video WHERE location = 'location_1' AND brand IN ('" . implode("','", $laptop_brands) . '\') GROUP BY brand ORDER BY FIELD (brand, "Acer", "Apple", "Dell", "HP-Compaq", "IBM-Lenovo", "Sony", "Toshiba", "ASUS", "Fujitsu", "Gateway"), official DESC';