Automatically join tables

  • Please Help Me!

    I have a relational database.

    I have a field that relate to another field from onother Table.

    I must Select all Fields (join tables and get my data)

    How get Relational Tables between tow table and create join statement in my query?

  • select *

    from Table1

    inner join Table2

    on Table1.Column1 = Table2.Column2

    Put your table names and column names into this.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Hi,

    Instead of * Use ColumnName whatever you want.

    SELECT t1.ColumnName1,t1.ColumnName2,t2.ColumnName1,t2.ColumnName2,...

    FROM Table1 AS t1

    INNER JOIN Table2 AS t2

    ON t1.ColumnName = t2.ColumnName

    ---

  • Is this homework? 😀

    I recommend you look up some sort of SQL Tutorial in Google, or get a "Teach yourself SQL in 24 hours/30 days" style of book. You'd do well to understand what's possible and how things work to use the relational database efficiently.

  • And look up "JOIN" in Books Online. That should help you figure it out.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

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

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