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‘)
原文:https://www.cnblogs.com/stonechina/p/12159584.html