Home  >  Article  >  Backend Development  >  求mysql查询集锦语句

求mysql查询集锦语句

WBOY
WBOYOriginal
2016-06-13 11:43:02744browse

求mysql查询汇总语句~
表结构如下:

id  uid  scroe<br />-------------<br />1    1    1.5<br />2    1    1.8<br />3    2    -5.5<br />4    3    0.8<br />5    2    8.2<br />6    1    -2<br />7    4    3<br />8    2    2.3<br />--------------<br />

uid即用户id,现在要查询并统计每个用户的总分,显示在用户下面,也即前端显示类似这样:
用户  分数<br />------------<br />1      1.5<br />1      1.8<br />1      -2<br />1汇总  1.3<br />2      -5.5<br />2      8.2<br />2      2.3<br />2汇总  5.0<br />3      0.8<br />3汇总  0.8<br />4      3<br />4汇总  3

Statement:
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