SELECT student_pop, COUNT(*) AS s_count
FROM table
GROUP BY student_pop

I am assuming your table looks like this...

Blah   student_pop
------------------------
Blah   Towns
Blah   Unions
Blah   Towns
Blah   Towns
Blah   Towns

The above query would return...

student_pop   s_count
----------------------------
Towns         4
Unions        1

That should get you going in the right direction, you are going to need to
Order the s_count column, and then do a MAXROWS=10 to get the top ten.

______________________________________________
Pete Freitag ([EMAIL PROTECTED])
CFDEV.COM / NETDesign Inc.
ColdFusion Developer Resources
http://www.cfdev.com/

-----Original Message-----
From: Jim Watkins [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 16, 2000 9:39 PM
To: CF-Talk
Subject: RE: returning top 10


What I mean is I do not want to hard code the top ten in.  I want Cold
Fusion/Oracle to determine what the top ten are from say a list of 60.

-----Original Message-----
From: Shawnea Carter [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 16, 2000 9:15 PM
To: CF-Talk
Subject: RE: returning top 10


Select top 10 * (or your fields)
FROM table
WHERE blah blah blah and student_pop
in('Towns','Union','White','Fannin','Habersham','Stephens','Rabun','Franklin
','Bibb','Jones')

-----Original Message-----
From: Jim Watkins [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 16, 2000 9:09 PM
To: CF-Talk
Subject: returning top 10


How do you write a SQL statement that will return the top 10 of something
(eg. top 10 salaries, top ten students by GPA, top ten populated counties,
etc.)?

Currently I have:
and student_pop
in('Towns','Union','White','Fannin','Habersham','Stephens','Rabun','Franklin
','Bibb','Jones')


----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.

----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.

----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to