Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am getting a syntax error on the code below. I wish to substitute the report text for each column clarifying the its meaning.

SELECT CONCAT(LastName, ', ', FirstName) AS "System Administrator", 
  studentcourse.CourseID AS "Certification"
    WHEN studentcourse.CourseID='Pending_CCSA_DCMA' THEN 'Pending CCSA Completion'
    WHEN studentcourse.CourseID='Pending_CCSE_DCMA' THEN 'Pending CCSE Completion'
    WHEN studentcourse.CourseID='P_CA_eHealth_DCMA' THEN 'CA eHealth Administrator'
    WHEN studentcourse.CourseID='P_CCSE_DCMA' THEN 'Checkpoint Security Engineer'
    WHEN studentcourse.CourseID='P_CCSA_DCMA' THEN 'Checkpoint Security Administrator'
    WHEN studentcourse.CourseID='P_LRCP_DCMA' THEN 'LogRhythm Certified Professional'
    END AS 'studentcourse.CourseID'
FROM studentcourse, student
where student.studentID=studentcourse.StudentID 
  and Student.IsActiveFlag='1' 
  and student.SubOrg5='Yes' 
    or studentcourse.CourseID='Pending_CCSE_DCMA'
    or studentcourse.CourseID='P_CA_eHealth_DCMA'
    or studentcourse.CourseID='P_CCSE_DCMA'
    or studentcourse.CourseID='P_CCSA_DCMA'
    or studentcourse.CourseID='P_LRCP_DCMA')
Order by LastName

Any assistance would be appreciated.

share|improve this question
Change the SELECT CASE to CASE. – ypercubeᵀᴹ Nov 8 '13 at 16:25
You are missing a comma after studentcourse.CourseID AS "Certification" – bluefeet Nov 8 '13 at 16:26
@bluefeet You're an excellent human parser – Phil Nov 9 '13 at 1:19
Just a little more tweeking to make it perfect. I should have caught the missing ','. Thank you! – Deborah Ballen Nov 12 '13 at 14:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.