But if several rows have the same a value as the max value then the b value
will be arbitrary, or?

Staffan


On Wed, Oct 29, 2014 at 7:43 PM, Richard Hipp <d...@sqlite.org> wrote:

> On Wed, Oct 29, 2014 at 2:38 PM, Baruch Burstein <bmburst...@gmail.com>
> wrote:
>
> > Hi,
> >
> > If I have a table, "t", with 2 columns, "a" and "b". Assuming that "a"
> is a
> > unique number, will the following query always return the whole row (that
> > is, with the correct "b" column) where "a" is the highest number below
> 50?
> >
> > SELECT max(a), b FROM t WHERE a<50;
> >
> >
> That is what it is suppose to do, yes.
>
> Note that SQL is unique among SQL database engines in supporting this
> behavior.  All other SQL database engines (that I know about) will either
> report the query above as an error, because column b is not in the GROUP BY
> clause and is not inside an aggregate function, or will return b from an
> arbitrary row, not necessarily the row on which a is maximal.
>
> --
> D. Richard Hipp
> d...@sqlite.org
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to