sql-table中的总计 [英] Totals in a sql-table

查看:69
本文介绍了sql-table中的总计的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨新闻组,


我有一个mysql表,用于存储竞赛中的用户点数。我可以

用php显示表格,你可以看到哪个用户有点数和多少,

最高点的一个站点(偏离航线)。 />

但是,我想在列表中显示所有用户的总积分形式

表格。


我真的不知道如何将所有价值的总价值合在一起。我的

第一个想法就是用数字做一些事情,但这只计算行数。


谁可以帮助我。

解决方案

*** RotterdamStudents写道/escribió(星期五,2004年5月7日10:04:16 +0200):

我真的我不知道如何将所有价值的总价值放在一起。我的第一个想法是用count做一些事情,但这只计算行数。




SELECT SUM(field)FROM table


-

-

- álvaroG。Vicario - 西班牙布尔戈斯

-




" Alvaro G Vicario" <人****************** @ telecomputeronline.com> schreef在

bericht新闻:6h **************************** @ 40tude.net ... < blockquote class =post_quotes> *** RotterdamStudents写道/escribió(星期五,2004年5月7日10:04:16 +0200):

我真的不知道如何获得总价值所有价值观在一起。
我的第一个想法是用count做一些事情,但这只计算行数。



SELECT SUM(field)FROM table



谢谢,但这不起作用。代码给出:

有资源ID#38分在这场比赛中得分。


我使用的代码是:

<?php


db = mysql_connect(" localhost"," user"," pass");

mysql_select_db(QUOT;质数据库",

Hi newsgroup,

I have a mysql table which stores points of users from a competition. I can
display the table with php, you see which user has points and how much, the
one with the highest points stands on one (off course).

But, I want to display the total amount of points of all users together form
the table standm in the column pts.

I really don''t know how to get the total value of all values together. My
first idea is to do something with count, but this only counts the rows.

Who can help me out.

解决方案

*** RotterdamStudents wrote/escribió (Fri, 7 May 2004 10:04:16 +0200):

I really don''t know how to get the total value of all values together. My
first idea is to do something with count, but this only counts the rows.



SELECT SUM(field) FROM table

--
--
-- álvaro G. Vicario - Burgos, Spain
--



"Alvaro G Vicario" <al******************@telecomputeronline.com> schreef in
bericht news:6h****************************@40tude.net...

*** RotterdamStudents wrote/escribió (Fri, 7 May 2004 10:04:16 +0200):

I really don''t know how to get the total value of all values together. My first idea is to do something with count, but this only counts the rows.



SELECT SUM(field) FROM table


Thanks, but this doesn''t work. The code gives:
"There are Resource id #38 points scored this competition."

The code I use is:
<?php


db = mysql_connect("localhost","user","pass");
mysql_select_db("dbase",


这篇关于sql-table中的总计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆