On Wed, Sep 14, 2016 at 3:10 PM, Clemens Ladisch <clem...@ladisch.de> wrote:

> The sort order of these strings looks correct.
>

As hinted by Clemens, you're sorting text values, not reals. See below. --DD

C:\Users\ddevienne>sqlite3
SQLite version 3.10.2 2016-01-20 15:27:19
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> create table stats (plan, cpu);
sqlite> insert into stats values ('pts46', 595.509361), ('pts46',
95.059669), ('DSNUTIL', 9.733366);
sqlite> .headers on
sqlite> .mode column
sqlite> select * from stats;
plan        cpu
----------  ----------
pts46       595.509361
pts46       95.059669
DSNUTIL     9.733366
sqlite> select plan, max(cpu) from stats group by plan order by 2 desc;
plan        max(cpu)
----------  ----------
pts46       595.509361
DSNUTIL     9.733366
sqlite> select plan, printf("%.6f", max(cpu)) from stats group by plan
order by 2 desc;
plan        printf("%.6f", max(cpu))
----------  ------------------------
DSNUTIL     9.733366
pts46       595.509361
sqlite>
sqlite> select typeof(max(cpu)), typeof(printf("%.6f", max(cpu))) from
stats group by plan;
typeof(max(cpu))  typeof(printf("%.6f", max(cpu)))
----------------  --------------------------------
real              text
real              text
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to