Add all columns in MySQL?
#5

Quote:
Originally Posted by Derexi
Посмотреть сообщение
I appreciate your help, but this isn't what I'm looking for. I've already made a system that counts and saves players' online time in seconds. I now want to add up each player's seconds together to get the total amount of seconds that all the players, collectively, have played in the server. Like this:

Table in MySQL database:
Код:
ID  | Name  |  Online_seconds
1      Bob       3600  +           <----- I need a code to add all these seconds
2      Tom       3240  +   
3      Sam       2100  = 8940   <----- to get this number
In that case you can do exactly what Lordzy said,

You can retrieve the total of seconds right from the database:

Код:
select sum(`Online_seconds`) from `your_table`;
Reply


Messages In This Thread
Add all columns in MySQL? - by Derexi - 08.12.2014, 11:12
Re: Add all columns in MySQL? - by welderlourenco - 08.12.2014, 11:27
Re: Add all columns in MySQL? - by Derexi - 08.12.2014, 12:26
Re: Add all columns in MySQL? - by Lordzy - 08.12.2014, 12:36
Re: Add all columns in MySQL? - by welderlourenco - 08.12.2014, 13:51

Forum Jump:


Users browsing this thread: 2 Guest(s)