combining columns in sql server 2008

  • Hello,

    I have 2 tables t1 and t2 .

    t1 has columns a,b,c,d,e

    t2 has columns a,b,f,g,h

    the a & b columns of both the tables contain different data of same datatype .

    I need to combine these two tables

    Here I need a result which has all the columns of t1 ,

    with column a having data from both t1.a and t2.a

    with column b having data from both t1.b and t2.b

    for all the columns in t1 , which doesnt have a corresponding column in t2 , the value entered should be null

    ie ; if t2 has a column with a=1

    this should be present in resultset with

    a=1 ,

    b=value corresponding to a=1,

    f=null,g=null ,h= null

    Please help me soon...

  • One script is better than thousand words.

    Please post table script, sample data and expected results. Look at the link in my signature and you'll find a guide on how to do it effectively.

    -- Gianluca Sartori

  • Please help me soon...

    please provide the table structures soon..;-)

    The_SQL_DBA
    MCTS

    "Quality is never an accident; it is always the result of high intention, sincere effort, intelligent direction and skillful execution; it represents the wise choice of many alternatives."

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

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