Syntax Error on Join Operation

  • I am trying to produce the total number of test for 2 types of test and sessions for October. I keep getting Syntax error on join operation.

    SELECT Booking.Lesson_CatId, Lesson_Categories.Lesson_Category, Booking.Lesson_Date, Count([Booking.Lesson_CatId]) AS Total_Number_Of_Tests

    FROM Lesson_Type INNER JOIN (Session_Information INNER JOIN (Lesson_Categories INNER JOIN Booking ON Session_Information.Booking_Id=Booking.Booking_Id) ON Lesson_Type.Lesson_TypeId = Session_Information.Lesson_TypeId) ON Lesson_Categories.Lesson_CatId = Lesson_Type.Lesson_CatId

    WHERE ([Booking].[Lesson_Date]) Between #10/1/2008# And #10/31/2008#;

  • Is this the error message you get?

    Msg 102, Level 15, State 1, Line 3

    Incorrect syntax near '#'.

    If not then please assist others to assist you by following the suggested posting format described by the link in my signature block.

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • No. It's saying Syntax error on Join operation. I am working with Microsoft Access.

    After clicking ok on the syntax error it automatically highlights the (Session_Information Join.

  • It is related to how the parens are used in the joins. Looks like the FROM clause needs to be rewritten.

  • If it's a MS Access, then go to a query tab; draw your query and use the pregenerated SQL statement in your code...

  • I will rewrite it instead in nested select statements and see if it works.

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

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