concatenating two columns

  • Hi,

    I am trying to concatenate/merge two columns into one. For example in my database table I have two columns A & B as follows

    A B

    James Bond

    austin powers

    I would like to join both of them in to a single column C as

    C

    James, Bonds

    austin, powers

    I tried using Union, but it returns C as

    Jame

    austin

    bond

    powers

    Any help or pointers will be greatly appreciated.

    thanks in advance for you help,

    Vijju

  • select A + ', ' + B from TABLE

    Regards,

    Andy Jones

    .

  • thank you Andy, that works like a charm.

  • Note however you may want to do ISNULL(A,'') + ISNULL(B,'') since if either columns is NULL then end results is NULL.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply