Hi,

SELECT DISTINCT fruit, count(fruit) AS fruitcount
FROM greengrocer
GROUP BY fruit
ORDER BY fruit

HTH,

Chris

------Original Message------
From: "chad jackson" <[EMAIL PROTECTED]>
To: CF-Talk <[EMAIL PROTECTED]>
Sent: January 25, 2001 11:39:49 PM GMT
Subject: help with sql query/CF


Hi,

I have a standard query like:

SELECT fruit
FROM greengrocer
ORDER BY fruit

Which returns

apple
apple
bananna
pineapple
pineapple
pineapple

How do I get sql/cold fusion to return
apple (2)
bananna (1)
pineapple (3)

Any help would really be appreciated

thanks
chad
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to