Monday, 15 March 2010

mysql - How to put two concat queries into the same table as two columns -



mysql - How to put two concat queries into the same table as two columns -

i've started using mysql , can't find reply anywhere maybe because doesn't exist?

i want set these 2 in 1 table 2 columns

select concat(name, ' ',category) pet_name_and_category animal select concat(firstname, ' ',lastname) customer_name petcustomer

so table want like:

gary, snail spongebob squarepants sandy, squirrel patrick star

where 2 separate columns in same table.

try this,

select name || ' ' || category animal union select firstname || ' ' || lastname petcustomer;

if want these separate column, can utilize this,

select name || ' ' || category pet, firstname || ' ' || lastname owner animal, petcustomer <join_condition_depending_on_table_structure>;

mysql sql concat

No comments:

Post a Comment