query help

  • Hi Please help for below requirement.

    I need to combine two columns of data and insert in new column

    ex: if have col1 has 1, 2, 3 and col2 has 1, 2, 3 and i need new column as col3 by combining col1 and col2 like 11, 22, 33

    I have two columns liek belwo

    col1 col2

    12

    15

    61

    27

    I need table like below

    Col1 col2 col3

    1212

    1515

    6162

    2727

    Thanks

    Aswin

  • assuming the data types of col1 and col2 are varchars:

    update SomeTable

    SET Col3 = Col1 + Col2

    if they are integers, you will have to explicitly cast/convert the two columns.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Awesome..its working..

    Thanks for your help

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

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