sql case when 操作

Posted on 2015-07-29 16:27  qhy1277  阅读(237)  评论(0编辑  收藏  举报

,(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 XML PATH('')) END) AuthorizeObject

Copyright © 2024 qhy1277
Powered by .NET 8.0 on Kubernetes