Select filename, count(filename)
from mytable
group by filename

Casey Cook




"Josh R" <[EMAIL PROTECTED]> on 07/26/2001 03:57:30 PM

Please respond to [EMAIL PROTECTED]

To:   CF-Talk <[EMAIL PROTECTED]>
cc:
Subject:  Listing items and counts - I'm stuck


What's the easiest way to output a list of items plus the number of times
they're listed?
I want an output like
Item - (count)

For example:

I have three downloadable scripts listed in my database. I have one table
that lists the item and each time it was downloaded (along with other info,
but those are the parts that matter)

I want to query the list so I can output something like:
cfx_coolscript - Downloaded 23 times
cfx_coolscript2 - Downloaded 154 times
cfx_coolscript3 - Downloaded 1 time

Is it possible to create a list and a count in a single query?

I'm aware of creating an incremental count field in the database and simply
displaying the value, but I want to know if there's some query/math
solution
too.

Thanks.

================================
Josh - [EMAIL PROTECTED]
================================
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to