你的位置:首页 > 数据库

[数据库]sql case when 操作


,(CASE WHEN (SELECT COUNT(1) FROM BookAuthorizeObject WHERE BookAuthorizeObject.BookNo=T.BookNo)=8 THEN '全集團使用' ELSE (SELECT (CASE AuthorizeSubObject WHEN '1' THEN '雄獅旅遊,' WHEN '2' THEN '雄獅資訊,' WHEN '3' THEN '雄獅通運,' WHEN '4' THEN '雄獅杏林事業,' WHEN '5' THEN '欣傳媒,' WHEN '6' THEN '傑森全球整合行銷,' WHEN '7' THEN '雙獅聯合,' WHEN '8' THEN '欣聯航,' END) FROM BookAuthorizeObject WHERE BookNo=T.BookNo FOR