Re: Order By [blank]

From: Date: Thu, 21 Dec 2006 17:39:35 +0000
Subject: Re: Order By [blank]
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-42834@lists.php.net to get a copy of this message
Unfortunately, I'm on 4.0.x so sub-queries are out. And yeah, I should get my host to upgrade.... but we both work for the government so that isn't happening. ;-) Any other thoughts. -- Kevin Murphy Webmaster: Information and Marketing Services Western Nevada Community College www.wncc.edu 775-445-3326 On Dec 21, 2006, at 9:30 AM, Naintara wrote: > Depending on your MySQL version you could use a subquery by > combining the > two queries you mentioned, for a fairly straight-forward query. > > http://dev.mysql.com/tech-resources/articles/4.1/subqueries.html > http://mysqld.active-venture.com/Subqueries.html > > You could read about optimizing subqueries for optimum queries. > > -----Original Message----- > From: Kevin Murphy [mailto:php@stubborndonkey.com] > Sent: Thursday, December 21, 2006 10:49 PM > To: php-db@lists.php.net > Subject: [PHP-DB] Order By [blank] > > I have this column in mysql: > > A > F > D > [ empty ] > A > C > > If I do an order by on that column, this is what I get: > > [ empty ] > A > A > C > D > F > > What I would like is this: > > A > A > C > D > F > [ empty ] > > Is there any way to achieve this in a single MySQL query? Using > DESC in this > case doesn't work, because while it puts the empty row in the last > place, it > does the rest as well. I could also do 2 queries where it calls it > once in > order WHERE !='', and then do another query to get the empty ones, > but that > seems a bit cumbersome. > > -- > Kevin Murphy > Webmaster: Information and Marketing Services Western Nevada Community > College www.wncc.edu > 775-445-3326 > > > > > -- > Kevin Murphy > Webmaster: Information and Marketing Services > Western Nevada Community College > www.wncc.edu > 775-445-3326 > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.db (#42834) next »