the database collation is: en_US.UTF-8 drop table t1; create table t1 (recid int ,f1 varchar(20)); insert into t1 values (1,'a'); insert into t1 values (2,' '); insert into t1 values (3,'aa'); insert into t1 values (4,' a'); select * from t1 order by f1
result: recid f1 2 " " 1 "a" -- 2 comes before 1 because space is smaller then 'a'. fine. 4 " a" -- now is see that 1 comes before 4 because space is greater then 'a' !? 3 "aa" -- now again, 4 comes before 3 because space is smaller the 'a' !?! can someone explain what's going on? thanks!