樱花公主

导航

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

posted on 2013-12-11 11:17  修炼1987  阅读(283)  评论(0编辑  收藏  举报