sql 语句中使用条件判断case then else end
sql 语句中使用条件判断case then else end范例:
SELECT les.[nLessonNo] FROM BS_Lesson AS les
WHERE les.[sClassCode] = 'BJ13Q2429'
AND (case when les.[sRealTeacherCode]<>'' then les.[sRealTeacherCode] else les.[sTeacherCode] end )= 'xxxxx'
order by les.[nLessonNo] ASC