On 11/25/15, Dave McKee <dragon at scraperwiki.com> wrote: > I can replicate this behaviour if I insert a zero-length string into the > column. > > sqlite> create table foo(a); > sqlite> insert into foo values(5); > sqlite> insert into foo values(""); > sqlite> select max(a) from foo; > > sqlite> select min(a) from foo; > 5 > sqlite> select avg(a) from foo; > 2.5 > > Is this a possible explanation? >
Indeed. Ryan sent me the database via private email: sqlite> select typeof(max(unitcost)), length(max(unitcost)) from bomdata; text|0 -- D. Richard Hipp drh at sqlite.org