MySQL combine two columns into one column
This is the only solution that would work for me, when I required a space in between the columns being merged.
select concat(concat(column1,' '), column2)
Try this, it works for me
select (column1 || ' '|| column2) from table;
It's work for me
SELECT CONCAT(column1, ' ' ,column2) AS newColumn;
My guess is that you are using MySQL where the +
operator does addition, along with silent conversion of the values to numbers. If a value does not start with a digit, then the converted value is 0
.
So try this:
select concat(column1, column2)
Two ways to add a space:
select concat(column1, ' ', column2)
select concat_ws(' ', column1, column2)