If you want the last record inserted (even if it was yesterday)

SELECT TOP 1 side_1_comments
FROM status
ORDER BY id DESC

If you want the last record inserted today

SELECT TOP 1 side_1_comments
FROM status
WHERE datechanged = '#DateFormat(Now(), "mm/dd/yyyy")#'
ORDER BY id DESC

This is assuming id is an autonumber

Pascal

> -----Original Message-----
> From: Robert Orlini [mailto:[EMAIL PROTECTED]
> Sent: donderdag 25 maart 2004 21:16
> 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]

Reply via email to