On Saturday 10 February 2007 12:45, balaraju mandala wrote:
> Hi Fello MySQL users,
>
> I am Bala Raju, i have a problem to extract data by writing query, i need u
> r help. Please help me.
>
> I have two tables, i am giving the tables as attachement, firs table is
> playersloginfo and second one is playerhanddetails.
>
> playersloginfo : This table stores all the loginsession details of the
> players, who visited the game.
>
> playerhanddetails: This table stores all the games the player played
> during a session.
>
> I need to extract the data from both these tables, i need to display the
> player's logintime, logouttime and the totaltime per a session(these are
> available in 1 table) and number of games the player played(from 2 table).
> Please give some ideas to write this queries.
>
> (I tried in this way to extract data, i simple selected all the columns and
> used time difference function, but to find number of games by a player, i
> need to use second table(playerhanddetails). I am searching second table by
> conditions of user_name, and date between (logindate, logoutdate) and
> time between (logintime, logouttime))

You should redesign your table playersloginfo. logindate and logintime should 
be merge into one field:  login DATETIME
The same goes for logoutdate and logouttime: logout DATETIME.

Then you query will be much easier to handle.

You should also change ip from varchar(15) to INT UNSIGNED and use INET_ATON 
to convert a ip of the form a.b.c.d to unsinged int, and INET_NTOA to go back 
to a.b.c.d

-- 
Jørn Dahl-Stamnes
homepage: http://www.dahl-stamnes.net/dahls/

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to