Re: Calculations

From: Date: Sat, 30 Aug 2003 14:07:29 +0000
Subject: Re: Calculations
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-30249@lists.php.net to get a copy of this message
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)

« previous php.db (#30249) next »