CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2004
    Posts
    438

    Merging field rows together - mysql

    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.

  2. #2
    Join Date
    Jun 2006
    Posts
    437

    Re: Merging field rows together - mysql

    Hi all.

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

    Code:
    SELECT TITLE AS MAIN_TITLE
      FROM PROP
    UNION
    SELECT TITLE AS MAIN_TITLE
      FROM TICKETS
    I hope this will help you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured