php如何输出表格内容比较快捷高效。。

WBOY
Release: 2016-06-23 14:21:20
Original
967 people have browsed it

php如何输出表格内容比较快捷高效。

比如我现在有test表。
里面有id,fenlei,mc
分别代表,id,自动增长,
fenlei,参赛地区
mc,具体的评选参数
id     fenlei    mc
1       北京      卫生好
2       上海      卫生好
3       上海      服务好
4       天津      卫生好
5       天津      服务好
6       北京      服务好
7       上海      卫生好
8       上海      服务好

我想对这个表格做一个统计。。用程序输出如下表格。

我想分别统计


回复讨论(解决方案)

select a.fenlei, count(*), count(*)/(select count(*) from test)*100 as percentage, constitutefrom test a, (select fenlei, group_concat(mc,',',cnt) as constitute from(select fenlei, mc, count(*) as cnt from test group by 1,2) t group by 1) t1where a.fenlei=t1.fenlei group by 1
Copy after login

数据库设计的太刁了

数据库设计的太刁了

你有什么好的建议。

mc是什么的缩写呀,名称?名次?

------------------------------------------------------AutoCSDN签名档------------------------------------------------------

码农场??码农播种代码、放牧思想的农场! 

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template