select tag, count(distinct(id)) from table_name group by tag; mysql里执行正确
模拟数据:
操作结果:
select tag,count(id)from tablegroup by tag;