Hello, I have a database composed of 4 items per category which I want to
replace from the oldest one with new products.  I do this instruction then:

<!--- I FIND THE OLDEST ITEM --->
<CFQUERY DATASOURCE="principal" QUERY="oldest">
SELECT
MIN(date) AS oldest
FROM recomendadas
WHERE category = #form.category#
</CFQUERY>

<!--- I REPLACE --->
<CFQUERY DATASOURCE="principal">
UPDATE recomendadas
SET cod = #form.cod#
titulo = #form.titulo#
WHERE category = #form.category#
<CFOUTPUT QUERY="oldest">
AND date = #createODBCdate(oldest)#
</CFOUTPUT>
</CFQUERY>

The problem with this is that it just replaces the item if it is 2 days old.
What should I do if I just want to replace the oldest one, no matter if it
is older by a minute?

As an additional data, I made a DB with one minute difference between items
an isolates perfectly the oldest item with this function:

CreateODBCdateTime(oldest)

But I don�t know why it does not do it in the above query.

Could anybody help me in this?

I appretiate it a lot

Manuel Tapiola
www.ciudadvideo.com

------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebarRsts&bodyRsts/cf_talk or send a message 
to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to