SELECT "date" FROM "table" WHERE "color" = 'red' ORDER BY "date" DESC LIMIT
1;
Don't worry about names, just quote your identifiers. They will stand out
and you can use anything you want.
Jerry
"Michael Glaesemann" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Scott,
>
> On No
On Nov 12, 2004, at 8:24 AM, Michael Fuhr wrote:
[Top-posting fixed]
On Fri, Nov 12, 2004 at 09:06:08AM -0500, Goutam Paruchuri wrote:
Scott Frankel wrote:
ORDER BY DESC LIMIT 1 is much simpler and more readable than a
sub-query. Though the sub-query approach looks to be a good template
for ensuri
[Top-posting fixed]
On Fri, Nov 12, 2004 at 09:06:08AM -0500, Goutam Paruchuri wrote:
> Scott Frankel wrote:
>
> > ORDER BY DESC LIMIT 1 is much simpler and more readable than a
> > sub-query. Though the sub-query approach looks to be a good template
> > for ensuring more accurate results by bei
entable g2
WHERE g2.color= g.color
) LIMIT 1
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Scott Frankel
> Sent: Thursday, November 11, 2004 11:13 PM
> To: [EMAIL PROTECTED]
> Subject
ORDER BY DESC LIMIT 1 is much simpler and more readable than a
sub-query.
Though the sub-query approach looks to be a good template for ensuring
more
accurate results by being more explicit.
Thanks to all who responded!
Scott
SELECT * FROM colortable WHERE color = 'red' ORDER BY date DESC LIMIT
On Thu, Nov 11, 2004 at 05:00:46PM -0800, Scott Frankel wrote:
> How does one return the latest row from a table, given multiple entries
> of varying data?
> i.e.: given a table that looks like this:
>
> color | date
> +
> red| 2004-01-19
> blue | 2004-05-24
> red
On Thu, 11 Nov 2004, Scott Frankel wrote:
>
> On Nov 11, 2004, at 5:09 PM, Michael Glaesemann wrote:
>
> > Scott,
> >
> > On Nov 12, 2004, at 10:00 AM, Scott Frankel wrote:
> >
> >> color | date
> >> +
> >> red| 2004-01-19
> >> blue | 2004-05-24
> >> red| 2004-04-
On Nov 11, 2004, at 5:09 PM, Michael Glaesemann wrote:
Scott,
On Nov 12, 2004, at 10:00 AM, Scott Frankel wrote:
color | date
+
red| 2004-01-19
blue | 2004-05-24
red| 2004-04-12
blue | 2004-05-24
How do I select the most recent entry for 'red'?
SELECT color, MAX(
PROTECTED]>
Sent: Thursday, November 11, 2004 5:09 PM
Subject: Re: [GENERAL] simple query question: return latest
> Scott,
>
> On Nov 12, 2004, at 10:00 AM, Scott Frankel wrote:
>
> > color | date
> > +
> > red| 2004-01-19
> >
Scott,
On Nov 12, 2004, at 10:00 AM, Scott Frankel wrote:
color | date
+
red| 2004-01-19
blue | 2004-05-24
red| 2004-04-12
blue | 2004-05-24
How do I select the most recent entry for 'red'?
SELECT color, MAX(date)
FROM giventable
WHERE color = 'red' -- omit this
Still too new to SQL to have run across this yet ...
How does one return the latest row from a table, given multiple entries
of varying data?
i.e.: given a table that looks like this:
color | date
+
red| 2004-01-19
blue | 2004-05-24
red| 2004-04-12
blue | 2004
11 matches
Mail list logo