From: <sinisa Date: March 23 1999 12:29am Subject: ORDER BY not ordering List-Archive: http://lists.mysql.com/mysql/815 Message-Id: <14070.57437.385509.528023@monster.local.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 | +---------------------------------------------------------------------+