joins with 3 tables

  • hi all

    can i join more than 2 tables.

    i means in union, we can union more than 2 tables

    select * from table1

    union

    select * from table2

    union

    select * from table3

    like wise can i join 3 tables..

    please guide me!!! ur answer very helpful for me!!! i am begineer, masters please help me!!

    --------------------------------------------------------

    I am Learner -- SQL

  • Yes, you can join more than 2 tables. Take this for example:

    select

    *

    from table1 a

    inner join table2 b

    on a.id = b.t1_id

    inner join table3 c

    on a.id = c.t1_id;



    Twitter: @SQLife
    Email: sqlsalt(at)outlook(dot)com

  • thanks alot:-):-)

    --------------------------------------------------------

    I am Learner -- SQL

  • Not a problem, and you are correct. I do recommend getting a beginner's book on SQL Server, as there are a lot of introductory topics that are required to be learned in order to advance your knowledge.



    Twitter: @SQLife
    Email: sqlsalt(at)outlook(dot)com

  • selvakumar.sms (5/13/2012)


    please guide me!!! ur answer very helpful for me!!! i am begineer, masters please help me!!

    In that case, please click on the following for some guidance that will easily turn you into a master DBA over time.

    [font="Arial Black"]All DBA Secrets Revealed Here[/font]

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)
    Intro to Tally Tables and Functions

  • thanks jeff your suggestion and ur answer helped me alot jeff.

    thanks alot

    --------------------------------------------------------

    I am Learner -- SQL

Viewing 6 posts - 1 through 5 (of 5 total)

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