Reputation: 2457
I have table like:
+------+-----+ | name | nick| +------+-----+ | yosi | Y | | adam | NULL| +------+-----+
I need output of one column, of nick if nick is not null, or of name if nick is null.
like this:
+------+ |result| +------+ | Y | | adam | +------+
Is there a query for that ?
Upvotes: 0
Views: 90
Reputation: 1944
In Access, I use the nz() function for that, eg:
SELECT nz(nick, name) as result FROM table
Upvotes: 1
Reputation: 24088
SELECT IFNULL(nick, name) as result FROM table
This will work in MySQL. See documentation here.
Upvotes: 4
Reputation: 1818
SELECT ISNULL(nick, name) as result FROM table
for Access and SQL server
Upvotes: 1