On Oracle:

SELECT * FROM (
SELECT myfield
FROM mytable
ORDER BY date_modified
)
WHERE ROWNUM = 1

Steve,
What db do you use?

> -----Original Message-----
> From: Nick Han [mailto:[EMAIL PROTECTED]
> Sent: dinsdag 17 februari 2004 20:58
> To: CF-Talk
> Subject: Re:query help...
>
> Jeremy, I didn't use the rownum example because in the given
> scenario, using rownum may not give you the latest mod date
> record from the all records in the table.
>
> Nick Han
>
> >>> [EMAIL PROTECTED] 02/17/04 10:28AM >>>
> Nick,
>
> FYI in oracle the "top" select is handled by the ROWNUM
> pseudocolumn...
>
> i.e. SELECT myfield FROM mytable WHERE ROWNUM<=10;
>
>
> Jeremy Brodie
> Edgewater Technology
>
> web: http://www.edgewater.com
> phone:(703) 815-2500
> email: [EMAIL PROTECTED]
>
>
> > In oracle, there is no 'top' select.  In the scenario given, a sub
> > select is the most efficient.
> >
> > My apology for not having asked Dan what DB he was using.
> >
> > Nick Han
> >
> > >>> [EMAIL PROTECTED] 02/17/04 10:53AM >>>
> > Why not select them ordered by date_modified and then just use the
> > first
> > record?  Or if you're worried about passing all of that
> data back and
> > forth you can use TOP (or whatever corresponds to your DB server)
> >
> > John Burns  
> >
> > -----Original Message-----
> > From: Steve Milburn [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, February 17, 2004 1:51 PM
> > To: CF-Talk
> > Subject: Re: query help...
> >
> > Daniel Farmer wrote:
> >
> > > This is my query...
> > >
> > > select * from estates where featured = 1 and
> > >
> > > [ I want to select the oldest date_modified field here ]
> > >
> > >
> > >
> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > Daniel Farmer
> > > Coldfusion Developer / Sales / Producer
> > > 613.284.1684
> > >
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to