首页 > 其他 > 详细

CASE WHEN

时间:2020-01-07 10:39:40      阅读:75      评论:0      收藏:0      [点我收藏+]
SELECT TOP (100) PERCENT t.id, t.samplecode, t.path, t.step, 

t.plan_start, t.plan_finish, t.actual_start, t.actual_finish, 

w.name AS workstationname, u.name, 

CASE WHEN t .plan_cancel IS NOT NULL THEN ‘cancel‘ 
WHEN t .plan_start IS NULL AND t .plan_finish IS NULL THEN ‘schedule-pending‘
WHEN t .actual_start IS NULL AND t .actual_finish IS NULL THEN ‘test-pending‘ 
WHEN t .actual_start IS NOT NULL AND t .actual_finish IS NULL THEN ‘testing‘ 
WHEN t .actual_start IS NOT NULL AND t .actual_finish IS NOT NULL THEN ‘finish‘ END AS status, t.comment
FROM dbo.todolist AS t LEFT OUTER JOIN 

dbo.workstation AS w ON t.workstation_id = w.id LEFT OUTER JOIN
                         dbo.users AS u ON t.performed_by = u.id
WHERE        (t.location = ‘EILAB‘)

  

CASE WHEN

原文:https://www.cnblogs.com/stonechina/p/12159584.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!