Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2005
    Posts
    76

    Unanswered: returning 2 columns as 1 column

    In this query

    SELECT E1.id, E2.id
    FROM productHeadings AS B1, productHeadings AS E1,
    productHeadings AS E2
    WHERE B1.id = E1.parent_id
    AND E1.id = E2.parent_id
    and B1.id = 1

    the result is 2 id columns... is there a way to return all id in 1 column?!

  2. #2
    Join Date
    Nov 2003
    Posts
    2,933
    Provided Answers: 12
    http://msdn2.microsoft.com/en-us/library/ms177561.aspx

    Note that the + sign for string concatenation is not ANSI standard and all other DBMS use || instead.

  3. #3
    Join Date
    Feb 2005
    Posts
    76
    if I understood right, + adds the two columns together, I just want 1 column that returns all ids
    eg
    Col1, Col2
    1, 2
    3, 4

    want it to return
    Col1
    1
    2
    3
    4

  4. #4
    Join Date
    Nov 2005
    Location
    San Francisco, CA
    Posts
    506
    Quote Originally Posted by STUCK1234
    if I understood right, + adds the two columns together, I just want 1 column that returns all ids
    eg
    Col1, Col2
    1, 2
    3, 4

    want it to return
    Col1
    1
    2
    3
    4
    You can use UNION to do that ...
    Success is the ability to go from one failure to another with no loss of enthusiasm.
    - Sir Winston Churchill
    Joydeep

Posting Permissions

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