Aggregate and LIMIT

Hello,
I want to know how often a player went VPIP the last 100 hands.
basicly works and delivers 10110100010...,
yet when I try to apply the aggregate function
I get
While I understand the error, I do not see how I could fix it.
Thanks!
I want to know how often a player went VPIP the last 100 hands.
- Code: Select all
SELECT (CASE WHEN flg_vpip='t' THEN 1 ELSE 0 END)
FROM holdem_hand_player_statistics
WHERE id_player=2
ORDER BY date_played
LIMIT 100;
basicly works and delivers 10110100010...,
yet when I try to apply the aggregate function
- Code: Select all
SELECT SUM(CASE WHEN flg_vpip='t' THEN 1 ELSE 0 END)
FROM holdem_hand_player_statistics
WHERE id_player=2
ORDER BY date_played
LIMIT 100;
I get
- Code: Select all
ERROR: column "holdem_hand_player_statistics.date_played" must appear in the GROUP BY clause or be used in an aggregate function
While I understand the error, I do not see how I could fix it.
Thanks!