Bug #26479 Use of CONCAT function with NULL fields
Submitted: 19 Feb 2007 16:17 Modified: 19 Feb 2007 16:41
Reporter: Jitendra Bangani Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.27 OS:Windows (Microsoft Windows XP)
Assigned to: CPU Architecture:Any
Tags: CONCAT NULL

[19 Feb 2007 16:17] Jitendra Bangani
Description:
When any of the fields used with the CONCAT function contains a NULL value, the output of the query for the records containing a NULL value in a particular field is NULL.

How to repeat:
Example:

mysql> SELECT vend_name, vend_state
    -> FROM vendors;
+-----------------+------------+
| vend_name       | vend_state |
+-----------------+------------+
| Bears R Us      | MI         |
| Bear Emporium   | OH         |
| Doll House Inc. | CA         |
| Furball Inc.    | NY         |
| Fun and Games   | NULL       |
| Jouets et ours  | NULL       |
+-----------------+------------+
6 rows in set (0.00 sec)

mysql> SELECT CONCAT(vend_name, ' (', vend_state, ')')
    -> FROM vendors;
+------------------------------------------+
| CONCAT(vend_name, ' (', vend_state, ')') |
+------------------------------------------+
| Bears R Us (MI)                          |
| Bear Emporium (OH)                       |
| Doll House Inc. (CA)                     |
| Furball Inc. (NY)                        |
| NULL                                     |
| NULL                                     |
+------------------------------------------+
6 rows in set (0.00 sec)

Here the last two records are displayed as NULL even though the 'vend_name' field for that record is NOT NULL.
[19 Feb 2007 16:41] MySQL Verification Team
We're sorry, but the bug system is not the appropriate forum for asking help on using MySQL products. Your problem is not the result of a bug.

Support on using our products is available both free in our forums at http://forums.mysql.com/ and for a reasonable fee direct from our skilled support engineers at http://www.mysql.com/support/

Thank you for your interest in MySQL.