sql question

  • I am writing a select statement with the Query Designer and I am

    pulling data from thee tables.

    The first two tables have a foreign key constraint but the third does not

    In the third table there is a column that matches a column in the first table

    The question is how do I pull data from all three tables that match the criteria

    from the first table column.

    In other words what operator do I use in the query designer to match up the data from

    the third table.

    maybe not so easy

    Just can,t get the result I want.

    🙂

  • Can you provide the DDL (create scripts) for the tables, or at least the relevant columns and their datatypes. Sample data would be nice too. 😉

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • u can use inner join in both table joins

  • derr?

    (newbie)

    I don,t understand...can you give example

  • select *

    from table1

    inner join table2 on table1.key = table2.key

    inner join table3 on table1.key = table3.key

    That's the SQL text. In Query Designer, I think you just drag the column from your third table onto the column from your first table (I haven't used a GUI for building a query in several years, and I think that's what you're trying to do here from what you wrote).

    Does that help?

    - 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

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

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