On Sat, Oct 25, 2003 at 11:49:46PM -0500, Adam Clauss wrote: > I have a select statement that selects two string (text) fields. In some > cases, the first of them may be NULL. In this case, I would like the second > field to be selected instead. It is also possible that in rare cases that > the second string may be NULL, in which case it should just return NULL. > > Ex: > I have a table similar to: > Key | str1 | str2 > 0 | "str1" | "anotherstr" > 1 | NULL | "string" > 2 | NULL | NULL > > > I would like the select statement to return: > Key | Str > 0 | "str1" > 1 | "string" > 2 | NULL > > How possible is this?
select coalesce(str1, str2); > > Adam Clauss > [EMAIL PROTECTED] > > -- René Seindal ([EMAIL PROTECTED]) Seindal Consult -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]