Reputation: 6820
So i have to columns in my table one called spend and one save.
what I would like to do is join the two so that is says offers and has the spend|save
Say I have table as
spend save
30 10
Output I want is
spend save dummyCol
30 10 30|10
Upvotes: 0
Views: 45
Reputation: 263933
try this:
SELECT `spend`, `save`, CONCAT(`spend`, '|', `save`) as dummyCol
FROM `myTable`
Upvotes: 0
Reputation: 31647
Try below
SELECT spend, save, CONCAT(spend, '|', save) as dummyCol from myTable;
Here is link with more details.. Look for CONCAT
.
Also look for CONCAT_WS
. It is useful when you want to add SAME thing at many places...
Upvotes: 0
Reputation: 270775
So you just want to concatenate them? Use CONCAT_WS()
to concatenate with a pipe separator:
SELECT CONCAT_WS('|', spend, save) AS spendsave FROM tbl;
Upvotes: 1