I am working on a query for NHibernate that needs to generate SQL that performs a join on multiple Keys. This is the query we thought would
work, but apparently the ON Syntax is incorrect.
Code:
SELECT tmpLocalizedLearningObjects, tmpLearningObjectsSession
FROM GeoLearning.Core.Course AS tmpCourse
JOIN tmpCourse.LearningObjects AS tmpLearningObjects
JOIN tmpLearningObjects.LocalizedLearningObjects AS tmpLocalizedLearningObjects
JOIN tmpLocalizedLearningObjects.AvailableCulture AS tmpAvailableCulture
JOIN tmpAvailableCulture.Language AS tmpLanguage
JOIN tmpAvailableCulture.Country AS tmpCountry
LEFT OUTER JOIN tmpLearningObjects.LearningObjectHasLearningObjectSessions AS tmpLearningObjectHasLearningObjectSessions
LEFT OUTER JOIN tmpLearningObjectHasLearningObjectSessions.LearningObjectSession AS tmpLearningObjectsSession
ON tmpLearningObjectsSession.Id=tmpLearningObjectHasLearningObjectSessions.LearningObjectsSessionId
AND tmpLearningObjectsSession.UserId = '499efa8d-07b4-4131-8d27-099fe3ea0d11'
WHERE tmpCourse.Id = 'bda1d519-ebd0-45eb-a842-4d407a8c8bec'
AND tmpLanguage.Code = 'en'
AND tmpCountry.Code = 'US'
We recieve a
Code:
NHibernate.QueryException: unexpected token: ON [<Query Omitted for post>]
Is there another way to achieve this query?
-Steve Nelson
snelson@geolearning.com