Re: [sqlite] Clarification on sqlite handling of mixed aggregate and non-aggregate columns

2014-10-29 Thread Igor Tandetnik
On 10/29/2014 5:42 PM, Baruch Burstein wrote: SELECT max(a), b FROM t WHERE a<50; Is there some way to filter *after* this is applied? Wrap it in another select: select * from ( SELECT max(a) maxa, b FROM t WHERE a<50 ) where b is not null; -- Igor Tandetnik

Re: [sqlite] Clarification on sqlite handling of mixed aggregate and non-aggregate columns

2014-10-29 Thread Baruch Burstein
On Wed, Oct 29, 2014 at 8:43 PM, Richard Hipp wrote: > > 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

Re: [sqlite] Clarification on sqlite handling of mixed aggregate and non-aggregate columns

2014-10-29 Thread James K. Lowden
On Wed, 29 Oct 2014 20:38:07 +0200 Baruch Burstein wrote: > 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

Re: [sqlite] Clarification on sqlite handling of mixed aggregate and non-aggregate columns

2014-10-29 Thread Richard Hipp
On Wed, Oct 29, 2014 at 4:28 PM, Staffan Tylen wrote: > But if several rows have the same a value as the max value then the b value > will be arbitrary, or? > Then b will be from one of the rows for which a is maximal - but you don't know which one. Similarly, if you

Re: [sqlite] Clarification on sqlite handling of mixed aggregate and non-aggregate columns

2014-10-29 Thread Staffan Tylen
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 wrote: > On Wed, Oct 29, 2014 at 2:38 PM, Baruch Burstein > wrote: > > > Hi, > > > > If I have a

Re: [sqlite] Clarification on sqlite handling of mixed aggregate and non-aggregate columns

2014-10-29 Thread Richard Hipp
On Wed, Oct 29, 2014 at 2:38 PM, Baruch Burstein 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

[sqlite] Clarification on sqlite handling of mixed aggregate and non-aggregate columns

2014-10-29 Thread Baruch Burstein
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; -- ˙uʍop-ǝpısdn sı ɹoʇıuoɯ