Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax error creating View 2

Status
Not open for further replies.

Ralph8

IS-IT--Management
Mar 15, 2003
168
US
Using the following code to create a new view, I keep getting "Syntax error near Keyword JOIN, Statement could not be processed".

I have tried every thing I can think of, and stared at the thing until I have a head ache. Can some one point me to it?

I know I will probably be embarrased by what I am over looking, but at this point I do not care.

Thanks

Ralph

SELECT dbo.tblCourseSched.*,
dbo.tblDistrictAgency.Number AS Expr1,
dbo.tblDistrictAgency.Name AS Expr2,
dbo.tblSemester.SemesterCode AS Expr3,
dbo.tblSemester.SemesterName AS Expr4,
dbo.tblTeacherPersonal.TeacherID AS Expr5,
dbo.tblTeacherPersonal.FullName AS Expr6
FROM dbo.tblCourseSched INNER JOIN
dbo.tblDistrictAgency ON
dbo.tblCourseSched.DistNumber = Expr1, JOIN
dbo.tblSemester ON
dbo.tblCourseSched.Semester = Expr3, JOIN
dbo.tblTeacherPersonal ON
dbo.tblCourseSched.EducatorID = Expr5, JOIN
dbo.tblProgramCodes ON
dbo.tblCourseSched.ProgCode = dbo.tblProgramCodes.ProgCode, JOIN
dbo.tblDeliverySystem ON
dbo.tblCourseSched.DeliveryCode = dbo.tblDeliverySystem.Code

TIA

Ralph D. Meredith
 
Try

SELECT dbo.tblCourseSched.*,
dbo.tblDistrictAgency.Number AS Expr1,
dbo.tblDistrictAgency.Name AS Expr2,
dbo.tblSemester.SemesterCode AS Expr3,
dbo.tblSemester.SemesterName AS Expr4,
dbo.tblTeacherPersonal.TeacherID AS Expr5,
dbo.tblTeacherPersonal.FullName AS Expr6
FROM dbo.tblCourseSched INNER JOIN
dbo.tblDistrictAgency ON
dbo.tblCourseSched.DistNumber = Expr1 JOIN
dbo.tblSemester ON
dbo.tblCourseSched.Semester = Expr3 JOIN
dbo.tblTeacherPersonal ON
dbo.tblCourseSched.EducatorID = Expr5 JOIN
dbo.tblProgramCodes ON
dbo.tblCourseSched.ProgCode = dbo.tblProgramCodes.ProgCode JOIN
dbo.tblDeliverySystem ON
dbo.tblCourseSched.DeliveryCode = dbo.tblDeliverySystem.Code

Just took out the commas after the expressions before the word JOIN.

DBomrrsm
 
That worked. I still had to change the "Expr"s back to the root names as they came up as invalid column names.

Thanks, my head ache is gone.

Ralph

TIA

Ralph D. Meredith
 
I'd be extremely surprised if you could use aliases from the SELECT clause in the JOIN clause...

If you're trying to cut down on the amount of typing and clutter, why don't you use an alias for the table names?

Code:
FROM dbo.tblCourseSched CS
   INNER JOIN dbo.tblDistrictAgency DA ON CS.DistNumber = DA.Number
   ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top