Solved

Incorrect syntax near the keyword 'WHERE'

Posted on 2007-12-06
3
168 Views
Last Modified: 2010-03-20
I'm just not seeing it...probably because I have a headhache:


SELECT	st.iStudentID,
			clp.iProjectID,
			clp.vchTitle,
			cpop.iClassProjectID,
			cl.siLessonNumber,
			st.vchUserName,
			st.vchFirstName,
			st.vchLastName,
			st.bEnabled,
			cse.iClassEnrollID
	FROM Student st (nolock)
		JOIN Class_StudentEnroll cse
		JOIN Student_Program sp ON sp.iStudentID = st.iStudentID
		JOIN vClassProgramOutcomeProjects cpop ON cpop.iProgramID = sp.iProgramID
		JOIN ClassLessonProject clp ON clp.iProjectID = clgp.iClassItemID
		JOIN ClassLesson cl ON cl.iClassLessonID = clp.iClassLessonID
		JOIN classGradePoint clgp ON clp.iClassLessonID = cl.iClassLessonID
		JOIN ClassLessonProject clp ON clp.iProjectID = clgp.iClassItemID
	WHERE ((cse.chLetterGrade IS NULL) OR (cse.chLetterGrade <> 'EW'))
		AND cse.bWithdrawn = 0
		AND cse.chEnrollType = 'STU'
		AND cse.iClassID = 9482

Open in new window

0
Comment
Question by:dba123
  • 2
3 Comments
 
LVL 25

Accepted Solution

by:
imitchie earned 250 total points
ID: 20423219
SELECT  st.iStudentID,
                        clp.iProjectID,
                        clp.vchTitle,
                        cpop.iClassProjectID,
                        cl.siLessonNumber,
                        st.vchUserName,
                        st.vchFirstName,
                        st.vchLastName,
                        st.bEnabled,
                        cse.iClassEnrollID
        FROM Student st (nolock)
                JOIN Class_StudentEnroll cse   ------- join condition needed here
                JOIN Student_Program sp ON sp.iStudentID = st.iStudentID
                JOIN vClassProgramOutcomeProjects cpop ON cpop.iProgramID = sp.iProgramID
                JOIN ClassLessonProject clp ON clp.iProjectID = clgp.iClassItemID
                JOIN ClassLesson cl ON cl.iClassLessonID = clp.iClassLessonID
                JOIN classGradePoint clgp ON clp.iClassLessonID = cl.iClassLessonID
                JOIN ClassLessonProject clp ON clp.iProjectID = clgp.iClassItemID
        WHERE ((cse.chLetterGrade IS NULL) OR (cse.chLetterGrade <> 'EW'))
                AND cse.bWithdrawn = 0
                AND cse.chEnrollType = 'STU'
                AND cse.iClassID = 9482
0
 
LVL 25

Expert Comment

by:imitchie
ID: 20423220
check the ----- line above ^^^
0
 
LVL 1

Author Comment

by:dba123
ID: 20423226
crap...thanks.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question