UPDATE
tablename
SET
status = 'approved'
WHERE
SKU = #URL.SKU# AND
statusWhen = (SELECT MAX(statusWhen) FROM tablename)
i think that should do it...
(to answer the actual question, I'm not sure if the MAX() function
will work as you originally asked)
On 6/12/06, Chad Gray <[EMAIL PROTECTED]> wrote:
> How would I write the SQL to update a record that has the most recent date?
>
> Say I want to change the status field to "Approved" where the date is the
> most recent and SKU = 12345
>
> Will the Max function work in the Where section of the SQL or is there
> another function to use to find the most recent date?
>
> UPDATE table
> SET STATUS = 'approved',
> WHERE SKU = #URL.SKU# AND MAX(StatusWhen)
>
>
> Thanks,
> Chad
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:243198
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54