You are here: Re: [PHP] Single SQL-statement in PHP to order... « PHP « IT news, forums, messages
Re: [PHP] Single SQL-statement in PHP to order...

Posted by Richard Lynch on 04/19/05 05:12

select ... from ... ORDER BY (IDCategory = 4) DESC,

IDCategory = 4 will return 1 or 0, for 4 or not 4.

1 is bigger than 0, in most countries. :-)



On Mon, April 18, 2005 2:50 pm, Gustav Wiberg said:
>> Hi there!
>>
>> I guess this is off-topic? but I want to know if this is possible. (If
>> there's anyone out there that have a solution, I would appreciate it
>> though)
>>
>> I want to know if there is anyway of showing tables in PHP in an order
>> like this in a single SQL-statement...
>>
>> Table is like this:
>> IDCategory
>> 7
>> 15
>> 4
>> 3
>>
>> I want to order the table like this: First everything that is IDCategory
>> 4, then the rest of the posts (doesn't matter which order)
>>
>> /G
>> @varupiraten.se
>>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
Like Music?
http://l-i-e.com/artists.htm

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация