Couldn't you do:
Select top 1 *
>From status
Order by datechanged desc
That will put the newest one on top and return only the top row. Am I
missing something?
John
-----Original Message-----
From: Robert Orlini [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 25, 2004 3:44 PM
To: CF-Talk
Subject: RE: Max id
Thanks Tony,...only now I get the SQL error below.
Robert O.
"Column name 'status.id' is invalid in the ORDER BY clause because it is
not contained in either an aggregate function or the GROUP BY clause."
-----Original Message-----
From: Tony Weeg [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 25, 2004 3:24 PM
To: CF-Talk
Subject: RE: Max id
try this...
Select TOP 1 MAX(ID), side_1_comments
from status
where datechanged = '#DateFormat(Now(), "mm/dd/yyyy")#'
group by side_1_comments
order by id DESC
tw
-----Original Message-----
From: Robert Orlini [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 25, 2004 3:16 PM
To: CF-Talk
Subject: Max id
I have a table that will be updated daily. In the table I want to select
info from the latest record even if it is today's date. I used MAX(ID)
to get the latest record. Is that good or am I going about this wrong?
So far it doesn't seem to do that with my script below:
<cfquery name="status" datasource="status_internal"> Select MAX(ID),
side_1_comments from status Where datechanged = '#DateFormat(Now(),
"mm/dd/yyyy")#'
</cfquery>
Thx.
Robert O. (HWW)
_____
[Todays Threads]
[This Message]
[Subscription]
[Fast Unsubscribe]
[User Settings]
- Max id Robert Orlini
- RE: Max id Tony Weeg
- Re: Max id Scott Weikert
- RE: Max id Robert Orlini
- RE: Max id Tony Weeg
- RE: Max id Burns, John D
- RE: Max id Tony Weeg
- RE: Max id Greg Luce
- RE: Max id Burns, John D
- RE: Max id Tony Weeg
- RE: Max id Burns, John D
- FW: Max id Robert Orlini
- FW: Max id Robert Orlini
- RE: Max id Pascal Peters
- RE: Max id Burns, John D
- RE: Max id Robert Orlini