"Dennis Volodomanov" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Funny enough, but it doesn't work on real data using v3.6.1... > > Here's the table: > > sqlite> .dump test_table > BEGIN TRANSACTION; > CREATE TABLE test_table (ID INTEGER PRIMARY KEY, ExternalID2 INTEGER, > ExternalID > INTEGER, Value ); > INSERT INTO "test_table" VALUES(1007,1,37,'-5'); > INSERT INTO "test_table" VALUES(1044,4,37,'-10'); > INSERT INTO "test_table" VALUES(1081,2,37,'-20'); > INSERT INTO "test_table" VALUES(1118,3,37,'-1'); > INSERT INTO "test_table" VALUES(1155,5,37,'-7'); > COMMIT; > sqlite> > > And here's the output: > > sqlite> select * from test_table; > 1007|1|37|-5 > 1044|4|37|-10 > 1081|2|37|-20 > 1118|3|37|-1 > 1155|5|37|-7 > sqlite> select min(Value) from test_table; > -1 > sqlite> select max(Value) from test_table; > -7
Well, '-7' comes lexicographically after '-1', no surprise here. By the same token, '5' would be greater than '10', since you insist on storing and comparing them as strings. Try select min(cast(Value as integer)), max(cast(Value as integer)) from test_table; Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users