Re: Calculations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jerry,

JeRRy said:
> Hi,
>
> I am not sure if this is possible or not or in what
> format etc.  Maybe it's a PHP, mysql or even a
> JavaScript thing.  But thought I'd post here and see
> if people are aware if it is possible for what I want
> to do.  I have searched alot on the net and yet have
> not come accross what I am looking for, so posting
> here may get me pointed in the right direction.  Okay
> here is what I wanna do. :)
>
> I have a list of users in multiple tables in the one
> database.  Each user has a field named 'score'.  As
> the table numbers go higher generally the score goes
> higher but never lower than the previous table.  There
> are 22 tables named 1 to 22.  So an example is below:

First of all, why do you have 22 tables???

It would be much more efficient using only ONE.
It would include the fields:

1) ID
2) user
3) score

or something like that. MySQL can easily order them by score.

SELECT user, score
FROM your_table
ORDER BY score

MySQL can also get the total score.

SELECT sum(score)
FROM your_table

So, I would call this a MySQL subject. Think over your database design.

Regards,
Sebastian




-- 

Once a problem is defined - it is half way solved. (Henry Ford)

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux