RE: [PHP-DB] Order By [blank]

2006-12-21 Thread Naintara
for optimum queries. -Original Message- From: Kevin Murphy [mailto:[EMAIL PROTECTED] 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

Re: [PHP-DB] Order By [blank]

2006-12-21 Thread Kevin Murphy
/Subqueries.html You could read about optimizing subqueries for optimum queries. -Original Message- From: Kevin Murphy [mailto:[EMAIL PROTECTED] 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

Re: [PHP-DB] Order By [blank]

2006-12-21 Thread David Mitchell
] 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

Re: [PHP-DB] Order By [blank]

2006-12-21 Thread tg-php
This is a little weird looking, but should do the job. Remember that items in your 'order by' can be manipulated conditionally. In this case, I'm looking for NULL as well as '' (empty) and changing it to something that should come after all your normal alphabetical values, but it doesn't

Re: [PHP-DB] Order By [blank]

2006-12-21 Thread tg-php
This is a little weird looking, but should do the job. Remember that items in your 'order by' can be manipulated conditionally. In this case, I'm looking for NULL as well as '' (empty) and changing it to something that should come after all your normal alphabetical values, but it doesn't

Re: [PHP-DB] Order By [blank]

2006-12-21 Thread David Mitchell
In case the blank is a null or is really a blank: select * from blank where tchar_10 is not null and tchar_10 != '' union all select * from blank where tchar_10 is null or tchar_10 = '' - Dave On 12/21/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: This is a little weird looking, but should

Re: [PHP-DB] Order By [blank]

2006-12-21 Thread tg-php
You shouldn't have to do that. the IFNULL() handles all that. If the item is null, it returns an emptry string ''. If it's blank/empty, it returns an empty string. This is just used for the comparison = ''. This determines if it's empty or null and if so, returns

Re: [PHP-DB] Order By [blank]

2006-12-21 Thread Kevin Murphy
I haven't tried the union method the query i have is actually quite a bit more complicated than just a simple select * from a single table, so while it may work, it might take a while to write it if I am reading all this right. But yes, the ifnull() method works just fine. Thanks for