try using a sub query.. like this:

select *
from foo f
where date = (
      select max(date)
       from goo g
       where f.id = g.id
       )

On Fri, Feb 15, 2008 at 10:24 AM, Walter Conti <[EMAIL PROTECTED]> wrote:
> The following query returns a recorderdset of 'forums' and 'lastpost' being 
> the last record the highest date, which is the only record I really need.
>  Is there a way of getting just "that" las record?
>  Thanks for helping.
>
>  <cfquery name="qGetLastPost" datasource="schoolsforums">
>    select max(sf_messages.posted) as lastpost,
>               sf_messages.title,
>               sf_users.username,
>               sf_forums.id as forumid,
>               sf_threads.id as threadid
>    from (((sf_messages
>            left join sf_threads on sf_messages.threadidfk = sf_threads.id)
>            left join sf_forums on sf_threads.forumidfk = sf_forums.id)
>            left join sf_users on sf_messages.useridfk = sf_users.id)
>    where sf_forums.id = 'CD4DBE82-874D-9864-ABB204DC22EC3285'
>    group by sf_messages.posted
>  </cfquery>
>
>  

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:3313
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15

Reply via email to