|
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]
|