Hi all,

I've got a mysql application that tracks golf events where players pick winners. Each event is associated by date with a "pick period" (ie a month).

I'm trying to get a COUNT() function to count all the picks by pick period for a given player (in this case id = "1"). The following SQL:

SELECT

golf_pick_periods.id,
golf_pick_periods.contest_id,
golf_pick_periods.period_name,
golf_pick_periods.period_start_date,
golf_pick_periods.period_end_date,

COUNT(golf_player_picks.id) AS period_picks_count

FROM

database.golf_pick_periods

LEFT JOIN

database.golf_player_picks

ON

golf_player_picks.picks_player_id = "1"

GROUP BY

golf_pick_periods.id

Yields the correct periods, but the SUM() is the same number for all of them when it should be different.

Can you have more than one GROUP BY clause? Essentially I'm grouping together the periods and in each period counting the picks. Help!

Best,

Peter D Bethke


--------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



Reply via email to