huh? this statement, select max(date_modified) from estates, will never return more than one record.

Therefore, using '=' is correct.

Nick Han

>>> [EMAIL PROTECTED] 02/17/04 01:37PM >>>
Daniel,

See the discussion from the orinigal post why this approach is not a good idea.
As your database grows, your application will slow to a grinding hault, even when you
cache qurries. Better to use the database to to the work

Use the following query

select * from estates where featured = 1 and
date_modified  in (select max(date_modified) from estates)

You had more than one record in your subquerry-- therefore you need to use
the IN keyword instead of =.

Jeremy Brodie

>Thanks John, that did it. =)
>  ----- Original Message -----
>  From: Burns, John
>  To: CF-Talk
>  Sent: Tuesday, February 17, 2004 2:30 PM
>  Subject: RE: query help...
>
>
>  Well, if you do top 1 you would not want dates desc or the first one
>  would be the newest (right?).  Other than that, you could just return
>  the whole query (if there's no sort of top syntax for your DB it'll
>  work, even though it's not very resourceful) and just do <cfoutput
>  query="blah" startrow="1" maxrows="1"> and that would just output the
>  first record.
>
>  John Burns
>
>  -----Original Message-----
>  From: Daniel Farmer [mailto:[EMAIL PROTECTED]
>  Sent: Tuesday, February 17, 2004 2:17 PM
>  To: CF-Talk
>  Subject: Re: query help...
>
>  I think this has been the closest yet... but still no work. =(
>    ----- Original Message -----
>    From: Philip Arnold
>    To: CF-Talk
>    Sent: Tuesday, February 17, 2004 2:04 PM
>    Subject: RE: query help...
>
>    select top 1 *
>    from estates
>    where featured = 1
>    Order by date_modified desc
>
>    > From: Daniel Farmer [mailto:[EMAIL PROTECTED]
>    >
>    > This is my query...
>    >
>    > select * from estates where featured = 1 and
>    >
>    > [ I want to select the oldest date_modified field here ]
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to