SELECT * FROM
(SELECT a.id,a.catid,a.title,a.thumb,a.description,a.pinpai,b.count,b.posnum FROM buses17_brand AS a LEFT JOIN buses17_statistics_res AS b ON a.id=b.cxid where a.catid = 38 and b.type=2 and (a.energy like '%纯电动%' or a.energy like '%混合动力%' or a.energy like '%燃料电池%') ORDER BY posnum DESC,count DESC limit 100)temp
GROUP BY temp. pinpai order by posnum desc,count desc