+--------------+ | isl_player | +--------------+ | pla_id | | pla_username | +--------------+
+--------------+ | isl_login | +--------------+ | pla_id | | log_created | +--------------+
+--------------+ | isl_transfer | +--------------+ | pla_id | | tra_amount | +--------------+
I have 1 database: - islandfever
I have 3 tables: - isl_player for every person; - isl_login for every login by a person as timestamp; - isl_transfer for every score by person;
What I need is: for every "person" the "last login" and "sum of all scores"
So I tried a double left join:
SELECT islandfever.isl_player.pla_username, max(islandfever.isl_login.log_created) as lastvisit, sum(islandfever.isl_transfer.tra_amount) as score
FROM islandfever.isl_player
LEFT JOIN islandfever.isl_transfer USING(pla_id)
LEFT JOIN islandfever.isl_login USING( pla_id )
GROUP BY isl_player.pla_id;
There is a problem with 2 joins in combination with aggreagate-functions (or at least I don't understand them...)
QUESTION: What is the approbriate sql-query for my problem?
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]