You are here: Re: Order mixed columns? « PHP Programming Language « IT news, forums, messages
Re: Order mixed columns?

Posted by Malcolm Dew-Jones on 10/28/89 11:30

frizzle (phpfrizzle@gmail.com) wrote:
: Hi all,

: I have a MySQL-table. 2 fields.
: Field 1 -> Name
: Field 2 -> Nick

: Now i want to order them alphabetically by Nick,
: BUT if Nick is empty it has to pick Name.
: How can i mix both of them ?
: (example below)


The oracle way would be

select *
from table
order by nvl(nick,name);

nvl returns the first argument unless it's null, in which case it returns
the second argument.

Mysql has a similar function, I think it's called ifnull(), but look it up
to be sure.


--

This programmer available for rent.

 

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

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