Inner Join Help

Results 1 to 3 of 3

Thread: Inner Join Help

  1. #1
    asp Guest

    Default Inner Join Help

    we are trying to join two tables (students and schools)... in the schools table there are all the school names with different id&#039;s and in the students table there are fields kinder, primary, secondary, postsec and university. Each of them correspond to an ID in the Schools table. We need to know how can we join the tables to get the school name for the kinder, primary, secondary, postsec and university from the schools table.<BR><BR>We tried this statement : SELECT,, FROM students INNER JOIN schools ON = WHERE = 73 <BR>but we are getting this error : <BR>Error Type:<BR>Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)<BR>[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.<BR><BR>Can anyone help us accomplish this task.<BR>Thank you very much :)

  2. #2
    Join Date
    Dec 1969

    Default RE: Inner Join Help

    I don&#039;t think the problem is the SQL statement, but the way you are executing it, can you send the code, or at least the relevant code.

  3. #3
    Join Date
    Dec 1969

    Default RE: Inner Join Help

    I hope this helps.... <BR>I set up the 2 tables and the 4 querries.<BR>1) qryKinder, which determines which kinder school each student attended.<BR>SELECT [tblStudent].[strStudentName], [tblSchools].[strSchoolName], [tblStudent].[intStudentID], [tblSchools].[intSchoolID]<BR>FROM tblSchools RIGHT JOIN tblStudent ON [tblSchools].[intSchoolID]=[tblStudent].[intKinderID];<BR><BR>2) & 3) same as above for Primary & Secondary Schools (could add more schools easy enough)<BR><BR>The the 4th querry joins the above..<BR>SELECT qryKINDER.intStudentID, qryKINDER.strStudentName, qryKINDER.strSchoolName, qryPrimary.strSchoolName, qrySecondary.strSchoolName<BR>FROM (qryKINDER INNER JOIN qryPrimary ON qryKINDER.intStudentID = qryPrimary.intStudentID) INNER JOIN qrySecondary ON qryPrimary.intStudentID = qrySecondary.intStudentID;<BR><BR>FINAL RESULTS...<BR>StudentID strStudentName qryKINDER.strSchoolName qryPrimary.strSchoolName qrySecondary.strSchoolName<BR>1 Fred kinderOne PrimaryOne SecondaryOne<BR>2 John KinderTwo PrimaryTwo SecondaryTwo

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts