sql case when 多条件

时间:2024-06-12 17:37:44

when

 'ChangeProductName'=
  case  --联名借姓名
   --when  a.ChangeProductName is not null   then (substring(a.ChangeProductName,0,charindex(',', ChangeProductName)))   --联名借姓名
   --when  a.ChangeProductName <> '' then (substring(a.ChangeProductName,0,charindex(',', ChangeProductName))) 
   when  (a.ChangeProductName is not null and a.ChangeProductName <> '')   then substring(a.ChangeProductName,0,charindex(',', ChangeProductName))   --联名借姓名
  end,