On Thu, Aug 14, 2008 at 9:45 PM, Dennis Volodomanov < [EMAIL PROTECTED]> wrote:
> > Seems to work ok for me. What values were you expecting? > > Yes, that works. Bad example on my part, sorry. > > What doesn't work is this: > > 1|2|-7 > 2|2|-5 > 3|2|-20 > 4|2|-5 > 5|2|-2 > > SELECT max(Data) FROM (SELECT Data FROM test_table WHERE ExternalID=2); > > This returns a -5, while I'm expecting a -2. > > Thank you, What version of SQLite are you using? I'm using the 3.5.7 version that came with OS X 10.5, and I get -2 as expected. Also, what's with the superfluous subquery? Why not just say SELECT max(Data) FROM test_table WHERE ExternalID=2; You can even do min and max at the same time: SELECT min(Data), max(Data) FROM test_table WHERE ExternalID=2; Or get real fancy: create view test_stats as select ExternalId, max(Data) as maxData, min(Data) as minData, avg(Data) as avgData from test_table group by ExternalId -- -- Stevie-O Real programmers use COPY CON PROGRAM.EXE _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users