There's probably a way to do it just in the query (using subqueries
perhaps), but here's one option:

Change your query to this:
Select catg, nltitle, nldate
from newsletters
order by catg, nldate DESC

Then, for your output:
<cfoutput query="yourQuery" group="catg">
#yourQuery.nldate#   #yourQuery.catg#   #yourQuery.nltitle#<br />
</cfoutput>


(that's untested, but that's the basic idea that should get you in the right
direction)

Scott

On Fri, Jul 30, 2010 at 10:54 AM, Les Mizzell <[email protected]> wrote:

>
> I'm trying to output a list of the most recent newsletters sorted by
> DATE. There are a number of categories that they fall under, and I must
> show only the newest 1 from each category..
>
>
> Select catg, nltitle, nldate
> from newsletters
> order by date
>
> Might return this:
> nldate          catg            nltitle
> --------------------------------------------
> 6/28/2010       grants          something title
> 6/28/2010       grants          another title
> 6/27/2010       news            yes a title
> 6/27/2010       news            good news today
> 6/25/2010       grants          more grant stuff
> 6/24/2010       toys            new hotwheels
> 6/23/2010       cars            new nissan models
> 6/23/2010       bob             another bob found!
> 6/23/2010       news            tom just died
>
> What I need to output is just:
>
> nldate          catg            nltitle
> --------------------------------------------
> 6/28/2010       grants          something title
> 6/27/2010       news            yes a title
> 6/24/2010       toys            new hotwheels
> 6/23/2010       bob             another bob found!
> 6/23/2010       cars            new nissan models
>
>
> "group by catg" won't work in the output, for obvious reasons. I've not
> been able to exactly get a query of queries to work either.
>
> Can someone point me in the correct direction here please?
>
>
-- 
-----------------------------------------
Scott Brady
http://www.scottbrady.net/


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:335905
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to