select t1.*, count(distinct name) from table t1
left join table2 t2 on t2.t1_id = t1.id
group by name
order by t2.order_colum
limit 0,1000
select t1.*, count(distinct name) from table t1
left join table2 t2 on t2.t1_id = t1.id
group by name
order by t2.order_colum
limit 0,1000
上一个文章:地址栏传参中文乱码