Home > Backend Development > PHP Tutorial > 还是问一个mysql的查询汇总的汇总有关问题

还是问一个mysql的查询汇总的汇总有关问题

WBOY
Release: 2016-06-13 11:43:18
Original
875 people have browsed it

还是问一个mysql的查询汇总的汇总问题

本帖最后由 setoy 于 2013-12-18 18:11:02 编辑 有五个人,uid分别是1~5
有对着这五个人打分的表格(某个人有可能没有得到过分数)
id  uid  scroe<br />-------------<br />1    1    1.5<br />2    1    1.8<br />3    2    -5.5<br />4    1    0.8<br />5    2    8.2<br />6    1    -2<br />7    4    3<br />8    2    2.3<br />--------------
Copy after login


现在要统计他们所有人的分数,即使查询不到某个人的得分,也要显示0分,显示格式如下:
用户  分数   汇总分<br />-----------------------<br />1      1.5     2.1<br />1      1.8     2.1<br />1      0.8     2.1<br />1      -2      2.1<br />2      -5.5    5<br />2      8.2     5<br />2      2.3     5<br />3      0       0<br />4      3       3<br />5      0       0<br />
Copy after login

Related labels:
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