OT - help in SQL query

2004-06-19 Thread Spectrum WebDesign
Hi

i'm looking for any help to do this query works fine

SELECT 
`groups`.`groupsDescr`,
`roles`.`roles_Agroup`,
`roles`.`rolesDescr`,
COUNT(`roles`.`rolesDescr`) AS TOTAL
FROM
`roles`
INNER JOIN `groups_roles` ON (`roles`.`rolesID` = `groups_roles`.`fkrolesID`)
INNER JOIN `groups` ON (`groups_roles`.`fkgroupsID` = `groups`.`groupsID`)
GROUP BY `roles`.`rolesDescr`
WHERE COUNT(`roles`.`rolesDescr`) GT 5

Using MySQL give me an error. how to do that?

Thanks for your time.

-- 
___
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]
 [Donations and Support]




Re: OT - help in SQL query

2004-06-19 Thread Nick de Voil
 i'm looking for any help to do this query works fine

 SELECT
`groups`.`groupsDescr`,
`roles`.`roles_Agroup`,
`roles`.`rolesDescr`,
COUNT(`roles`.`rolesDescr`) AS TOTAL
 FROM
`roles`
INNER JOIN `groups_roles` ON (`roles`.`rolesID` =
`groups_roles`.`fkrolesID`)
INNER JOIN `groups` ON (`groups_roles`.`fkgroupsID` =
`groups`.`groupsID`)
 GROUP BY `roles`.`rolesDescr`
 WHERE COUNT(`roles`.`rolesDescr`) GT 5


 Using MySQL give me an error. how to do that?

All those backticks give me a headache  probably MySQL too.

GT isn't SQL, it's CFML.

Most importantly, you need to GROUP BY the columns that *aren't* referenced
in aggregate functions (eg COUNT), not the ones that are.

Nick
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]
 [Donations and Support]