SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Evangelist
    Join Date
    Aug 2006
    Location
    Chicago
    Posts
    542
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Combining columns from different tables

    I have two tables that have some similar column names. I want to group the results of two columns into one single column (the datatypes are the same). But in a way that is like inserting all the columns in one table. So if Table1 has 20 records and Table2 has 30 records, I'd want a result of 50 records in one column.

    Suppose this is what I have:

    Code:
    Table1
    -------
    Col1
    -------
    1
    2
    5
    
    Table2
    -------
    Col1
    -------
    2
    3
    4
    I want the result to be like this:
    Code:
    -------
    col2
    -------
    1
    2
    5
    2
    3
    4

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,396
    Mentioned
    147 Post(s)
    Tagged
    4 Thread(s)
    Use UNION ALL


Bookmarks

Posting Permissions

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