Mysql query problem

Codes here !

Moderators: macek, egami, gesf

kick_tisho
New php-forum User
New php-forum User
Posts: 7
Joined: Fri Nov 22, 2002 7:48 am

Mysql query problem

Postby kick_tisho » Sun Dec 15, 2002 2:31 am

Hi all,
I'm not so experienced at all and i have difficulties writing a complicated query. After taking me whole yesterday i decided not to lose any more nerves, but to ask for help :)

here is the table.

CREATE TABLE trivia_results (
player_id int(10) unsigned NOT NULL,
points smallint(5) unsigned NOT NULL ,
game_date_end int(10) unsigned NOT NULL,
answered_questions tinyint(3) unsigned NOT NULL
)

in this table i keep records for player results for a trivia game.
game_date_end is for PHP timestamp. A sampe row is

player_id points game_date_end answered_q
1 625 1036952313 5


So the query i can't write must make a standing. It should take the last 10 games average points for a player and to
order the players in a standing proper way.


if somebody can help me, i'll greatfull.
Best Regards Ivan Kostov

User avatar
Oleg Butuzov
Last Samuray
Last Samuray
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Postby Oleg Butuzov » Mon Dec 16, 2002 4:23 am

I did not see a qustion. can you tell me what you want ?

P.S.
If you can in russian or Ukrainian...

kick_tisho
New php-forum User
New php-forum User
Posts: 7
Joined: Fri Nov 22, 2002 7:48 am

Mysql query

Postby kick_tisho » Mon Dec 16, 2002 6:59 am

I'm from Bulgaria, and don't know russian very well :)
The question is the query it self. I simply can't figure it out.
That's my problem :). How to make my standing query from this table. How to get last 10 games average points from a player and to order them, that the most points player goes top :)

Best Regards Ivan Kostov,
icq:71729968

User avatar
fabrizzio
New php-forum User
New php-forum User
Posts: 10
Joined: Fri Dec 13, 2002 2:22 pm

Postby fabrizzio » Mon Dec 16, 2002 7:09 am

maybe you can do this:
1-get the numbrer of rows (mysql_num_rows() )
2- $x = number - 10
2-then use a select avg(whatever) from table limit number,10;

kick_tisho
New php-forum User
New php-forum User
Posts: 7
Joined: Fri Nov 22, 2002 7:48 am

Mysql query

Postby kick_tisho » Mon Dec 16, 2002 7:36 am

10x for the help , but the query is pretty more complicated


Return to “mySQL & php coding”

Who is online

Users browsing this forum: No registered users and 2 guests

cron