I would like select the TOP X records for each category, (see below). If
there are more then two results that match as top of the category, I don't
care which two I get, just so I get only the TOP X for each category.  I
can't seem to get my head around this one.

Desired Results:
TYPE            NAME    VIEWS
Campground      X       4
Campground      Bar     3
Trail           Here    3
Trail           There   3
Lake            Med     3
Lake            Small   2

>From Table:
TYPE            NAME    VIEWS
Campground      Foo     2
Campground      Bar     3
Campground      X       4
Campground      Y       3
Trail           Joe's   1
Trail           Pac     2
Trail           Here    3
Trail           There   3
Lake            Big     1
Lake            Small   2
Lake            Med     3

For example:
NAME    VIEWS
rec1    4
rec2    3
rec3    3
rec4    3

In this case, I would want rec1 and any one of the following 3.

Another example:
NAME    VIEWS   
rec1    5
rec2    5
rec3    5
rec4    3


In this case, I would want any two of the first three records, either
random, alphabetically, or unordered would be fine.

--------------
Ian Skinner
Web Programmer
BloodSource
Sacramento, CA

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=6
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=6

Get the mailserver that powers this list at 
http://www.coolfusion.com

                        

Reply via email to