Work your joins from the inside out.  What I mean by that:  You have a
Registration table that is joined to the other three.  Start with that and
join to one table.  Now that is a "virtual" table you can join to.

SELECT
    r.Sched_ID, sc.Month_Name, sc.City, sc.Days
    , c.Course_ID, c.Course_Name, r.Price
    , r.Reg_ID,  st.First_Name, st.Last_Name
    , st.Company, st.Email, st.Title, st.Where_Learned
FROM
    Schedule sc          -- third join
INNER JOIN
    (Course c            -- second join
INNER JOIN
    (Students st         -- first join
INNER JOIN
    Registration r       -- Start here
ON
    st.Student_ID = r.Student_ID)
ON
    c.Course_ID = r.Course_ID)
ON
    sc.Sched_ID = r.Sched_ID
WHERE
    r.Reg_ID = 842



David L. Penton
"Mathematics is music for the mind, and Music is Mathematics for the
Soul." - J.S. Bach
[EMAIL PROTECTED]

  "If you want an ISP with great Network
   connectivity and great email,
   DON'T use AT&T @Home"


-----Original Message-----
From: Bruce Sorge

Everytime I run this query I receive two records. When I look at the
Registration table though, there is only one record. Am I doing the
INNERJOINS wrong?

SELECT Registration.Sched_ID, Schedule.Month_Name, Schedule.City,
Schedule.Days, Course.Course_ID, Course.Course_Name, Registration.Price,
    Registration.Reg_ID,  Student.First_Name, Student.Last_Name,
Student.Company, Student.Email, Student.Title, Student.Where_Learned
FROM Schedule INNER JOIN
    Registration ON Schedule.Sched_ID = Registration.Sched_ID INNER JOIN
Course ON Registration.Course_ID = Course.Course_ID
    INNER JOIN Student ON Registration.Student_ID = Student.Student_ID
WHERE (Registration.Reg_ID = 842)


-------------------------------------------------------------------------
This email server is running an evaluation copy of the MailShield anti-
spam software. Please contact your email administrator if you have any
questions about this message. MailShield product info: www.mailshield.com

-----------------------------------------------
To post, send email to [EMAIL PROTECTED]
To subscribe / unsubscribe: http://www.dfwcfug.org

Reply via email to