4 messages in com.mysql.lists.mysqlWhere on count(*)
FromSent OnAttachments
Pupeno26 Jul 2005 11:52 
SGr...@unimin.com26 Jul 2005 11:54 
mfat...@free.fr26 Jul 2005 12:55 
Peter Brawley27 Jul 2005 00:35 
Subject:Where on count(*)
From:Pupeno (pup@pupeno.com)
Date:07/26/2005 11:52:48 AM
List:com.mysql.lists.mysql

I have esentially this query (the list of integers may differ):

SELECT `Plans`.`id`, `Plans`.`name`, count(*) as 'count' FROM `Plans` JOIN `TechsPerPlan` ON `Plans`.`id` = `TechsPerPlan`.`plan` WHERE `TechsPerPlan`.`id` IN (17, 48, 54, 64, 75, 13, 30, 37, 45, 55, 65, 76, 11, 33, 46, 58, 68, 80) GROUP BY `Plans`.`id`

Of that result I want those with count bigger than N (being N a number, like 3), I tried this:

SELECT `Plans`.`id`, `Plans`.`name`, count(*) as 'count' FROM `Plans` JOIN `TechsPerPlan` ON `Plans`.`id` = `TechsPerPlan`.`plan` WHERE `TechsPerPlan`.`id` IN (17, 48, 54, 64, 75, 13, 30, 37, 45, 55, 65, 76, 11, 33, 46, 58, 68, 80) AND count >= 3 GROUP BY `Plans`.`id`

but it selected only those with less that 3, what I am doing wrong ?

Thanks