Details
-
Improvement
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
None
Description
A little late but here is my solution to the mysql concat problem from the mailing list for the documentation.
When using the generic database connector with a mysql connection you have to be aware of the behaviour of the concat command if you combine multiple columns.
For example the following query will not work if any value is NULL:
SELECT id AS $(IDCOLUMN), CONCAT("http://my.base.url/show.html?record=", id) AS $(URLCOLUMN), CONCAT(name, " ", description, " ", what_ever) AS $(DATACOLUMN) FROM accounts WHERE id IN $(IDLIST)
You'll have to use the ifnull operator to circumvent the issue.
SELECT id AS $(IDCOLUMN), CONCAT("http://my.base.url/show.html?record=", id) AS $(URLCOLUMN), CONCAT(name, " ", IFNULL(description, ""), " ", IFNULL(what_ever, "")) AS $(DATACOLUMN) FROM accounts WHERE id IN $(IDLIST)