是的你可以:
select num, string, 100 * num / total as percentfrom ( select count(*) as num, string from useragent_ip left join useragents on useragent_id = useragents.id group by useragent_id) xcross join ( select count(*) as total from useragent_ip left join useragents on useragent_id = useragents.id) yorder by num desc, string;
我删除了
having num > 2,因为它似乎没有意义。



