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))


playersloginfo:
--------------
+------------+-------------+------+-----+---------+-------+
| Field      | Type        | Null | Key | Default | Extra |
+------------+-------------+------+-----+---------+-------+
| user_name  | varchar(20) | YES  |     | NULL    |       |
| ip         | varchar(16) | YES  |     | NULL    |       |
| action     | varchar(15) | YES  |     | NULL    |       |
| logindate  | date        | YES  |     | NULL    |       |
| logoutdate | date        | YES  |     | NULL    |       |
| logintime  | time        | YES  |     | NULL    |       |
| logouttime | time        | YES  |     | NULL    |       |
| status     | varchar(15) | YES  |     | NULL    |       |
+------------+-------------+------+-----+---------+-------+

playerhanddetails :
-----------------
+----------------+-------------+------+-----+---------+-------+
| Field          | Type        | Null | Key | Default | Extra |
+----------------+-------------+------+-----+---------+-------+
| playername     | varchar(20) | YES  |     | NULL    |       |
| handnumber     | bigint(20)  | YES  |     | NULL    |       |
| date           | date        | YES  |     | NULL    |       |
| time           | time        | YES  |     | NULL    |       |
+----------------+-------------+------+-----+---------+-------+

Reply via email to