On Saturday 10 February 2007 19:21, balaraju mandala wrote:
> Hi Jorn,
>
> Thank you for reply, of course i can merge the columns and change the
> datatype. But buddy that is not problem here, the problem is extract the
> data.
After reading your message once more, I realise that you should do even more
changes. The username should not be a part of the playersloginfo table.
Consider this:
Table: userinfo
id mediumint unsigned not null auto_increment,
user_name varchar(20)
Table: playersloginfo
user_id mediumint unsigned not null comment '-->userinfo.id',
ip logint unsinged,
action varchar(15),
login datetime,
logout datetime,
status varchar(15)
Table: playershanddetails
playername mediumint unsigned not null comment '-->userinfo.id',
handnumber bigint(20),
date_time datetime
Your query might look something like.
select u.user_name,l.login,l.logout,timediff(l.login,l.logout) as totaltime,
count(h.*) as no_of_games from userinfo as u inner join playersloginfo as l on
(l.user_id=u.id) inner join playershanddetails as h on (h.playername=u.id)
group by u.id;
Please note: I have not tried this... just a quick suggestion right out of my
brain... :-)
--
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]