On 3 Jul 2012, at 1:22, ajmcello wrote: > db=# SELECT name,date,percent,price,time,amount FROM name WHERE amount >= '1000000' AND date='$today' ORDER BY percent DESC; > > name | date | percent | price | time | amount > --------+------------+----------------+---------+----------+---------- > BOB | 2012-07-02 | 63.77 | 8.86 | 14:59:00 | 26975372 > BOB | 2012-07-02 | 63.77 | 8.86 | 15:01:00 | 27001372 > BOB | 2012-07-02 | 64.06 | 8.8755 | 15:04:00 | 27145552 > BOB | 2012-07-02 | 63.77 | 8.86 | 14:57:00 | 26946338 > GIL | 2012-07-02 | 38.72 | 0.6789 | 14:55:00 | 1012880 This output makes no sense with the sort order you specified. Are you sure that the output matches the query? If it does, is percent a numeric field or is it a varchar where the numbers have varying amount of leading space perhaps? Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you'll find there is no forest. -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general