2 messages in com.mysql.lists.javaconfused by mysql command:select * .....
FromSent OnAttachments
lanxiazhi03 Aug 2006 08:13 
Fabian Schmidt04 Aug 2006 01:30 
Subject:confused by mysql command:select * ..order by if(death is null,0,1),death;
From:lanxiazhi (lanx@gmail.com)
Date:08/03/2006 08:13:00 AM
List:com.mysql.lists.java

i am learning mysql command to retrieve information from a table.and i want to
sort the result.i have a table named president,contains fields
like:first_name,last_name,death(which can be null to indicate the president is
still alive or a death-date ),so i use : select first_name,last_name,death from president order by if(death is
null,0,1),death desc; the result is like(of the death field): null null null 2004-06-05 1994-04-22 ... ... the result confused me. since it's ordered by two fields at the same time:one field can be 0 or 1,the
other is a date field,so things is much like the following: 0,null 0,null 0,null 1,2004-06-05 1,1994-04-22 ... but it's by desc order ,i think the result should be: [1,]2004-06-05 [1,]1994-04-22 [0,]null [0,]null [0,]null but it not .who can tell me why?