jaycangel
asked on
CONCAT a fields if one field is NULL
I would like to concat two fields
select CONCAT(field1, field2)
if field1 or field2 is NULL then i want it treated as a blank string. I've tried CAST, but it doesn't work. As soon as you have a null in a CONCAT it will not work at all, not even partial.
Thanks
select CONCAT(field1, field2)
if field1 or field2 is NULL then i want it treated as a blank string. I've tried CAST, but it doesn't work. As soon as you have a null in a CONCAT it will not work at all, not even partial.
Thanks
select CONCAT(COALESCE(field1,'') , COALESCE(field2,''))
In sql server
SELECT ISNULL(field1,'')+ISNULL(f ield2,'')
SELECT ISNULL(field1,'')+ISNULL(f
In Oracle -
select concat(nvl(field1,''),nvl( field2,'') )
select concat(nvl(field1,''),nvl(
in ingres
select concat(ifnull(field1,''),i fnull(fiel d2,'')) from table
in firebird
select coalesce(field1,'') || coalesce(field2,'') from rdb$database
select concat(ifnull(field1,''),i
in firebird
select coalesce(field1,'') || coalesce(field2,'') from rdb$database
ASKER
How can i do it in MySQL?
my initial suggestion works in mysql
ASKER
but mysql doesn't have COALESCE ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.