List:General Discussion« Previous MessageNext Message »
From:<sinisa Date:March 23 1999 12:29am
Subject:ORDER BY not ordering
View as plain text  
joshg@stripped writes:
 > I am trying to get the following query to work.  All fields of relevance 
 > are varchars (though of different lengths).  It does not sort properly.  
 > It seems, though not absolutely certain, that when the 
 > project_program field is null, I get problems, e.g. last names out of 
 > order even though in the same division and project_program.
 > 
 > SELECT
 >      ID,
 >      first_name,
 >      last_name,
 >      division,
 >      project_program,
 >      admin_title,
 >      appt_phone,
 >      degree_md,
 >      degree_np
 >    FROM directory
 >    ORDER BY 
 >      division, project_program, last_name, first_name
 > 
 > It's not the data.  Using group by doesn't help.  Any thoughts 
 > greatly appreciated
 > 
 > 
 > =========================
 > Josh Greenberg, Esq.
 > Dowling 302
 > One Boston Medical Ctr. Pl.
 > Boston, MA  02118
 > Tel) 617-414-7415
 > FAX) 617-414-3833
 > E-mail) Joshg@stripped
 > 

Hi!

Try to get read of NULL values by adding a WHERE clause wth IS NOT
NULL expression.

Sinisa

+---------------------------------------------------------------------+
| TcX  ____  __     _____   _____  ___        ==  mysql@stripped        |
|     /*/\*\/\*\   /*/ \*\ /*/ \*\ |*|        Sinisa Milivojevic      |
|    /*/ /*/ /*/   \*\_   |*|   |*||*|        mailto:sinisa@stripped |
|   /*/ /*/ /*/\*\/*/  \*\|*|   |*||*|        Belgrade                |
|  /*/     /*/  /*/\*\_/*/ \*\_/*/ |*|_____   Serbia                  |
|  ^^^^^^^^^^^^/*/^^^^^^^^^^^\*\^^^^^^^^^^^                           |
|             /*/             \*\                   Developers Team   |
+---------------------------------------------------------------------+
Thread
ORDER BY not orderingjoshg23 Mar
  • ORDER BY not orderingsinisa23 Mar