Click to See Complete Forum and Search --> : Merging field rows together - mysql


Nibinaear
September 27th, 2008, 06:26 PM
I'm trying to get some rows from 2 separate columns and treat them as one field. For example, prop.title has 5 rows, tickets.title has 10 rows, I want to make a new field called main_title which has 15 rows, how do I do this? I can't find a way in sql of doing this in a query. I've searched for merge and lots of other things, but just keep finding CONCAT or group by etc.

Please help.

davide++
September 29th, 2008, 03:42 AM
Hi all.

If prop.title and tickets.title have the same data type, you can use the UNION operator.
For example


SELECT TITLE AS MAIN_TITLE
FROM PROP
UNION
SELECT TITLE AS MAIN_TITLE
FROM TICKETS


I hope this will help you.