schone Posted May 23, 2006 Share Posted May 23, 2006 Hi All!Here is some initial info:Table reports_interventions has:- id- date- player_id- qu_id- value[b]What I'm trying to do is:[/b]Select all the player_id's who have the the same qu_id three times or more.[i]For example[/i]date = 2006-05-20player_id = 5qu_id = 3value = 4date = 2006-05-21player_id = 5qu_id = 3value = 3date = 2006-05-22player_id = 5qu_id = 3value = 7[b]What I have currently is:[/b][code]SELECT COUNT( qu_id ) , player_idFROM reports_interventionsGROUP BY player_id, qu_idHAVING COUNT( qu_id ) >3[/code] The problem is that it selects all qu_ids and counts them.What I want it to do is [b]select all qu_ids[/b] which are [b]the same[/b] which [b]occur 3 times or more[/b] for a [b]certain player_id.[/b]Please Help!!!Thanks to All!:) Quote Link to comment https://forums.phpfreaks.com/topic/10236-select-with-counts-and-havings-problems/ Share on other sites More sharing options...
fenway Posted May 23, 2006 Share Posted May 23, 2006 I'm not sure I understand why you have the second group clause. Quote Link to comment https://forums.phpfreaks.com/topic/10236-select-with-counts-and-havings-problems/#findComment-38153 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.