SELECT --a.YnUse,
(select case when (SELECT isnull(b.FID,0) FROM dbo.tbUserPermission b
WHERE a.MID = b.MenuID AND a.FID = b.MID AND a.FunID = b.FunID
-- and b.UID = 44 and a.MID=904 )>0 then 'Tree' else 'False' end )as YnUse
and b.UID = 51 )>0 then 'True' else 'False' end ) as YnUse ,
a.FID,a.MID,a.FunID,a.Memo FROM dbo.tbSysPurviewMenu a
WHERE a.MID=904
SELECT YnUse=
(select case when (SELECT isnull(b.FID,0) FROM dbo.tbUserPermission b
WHERE a.MID = b.MenuID AND a.FID = b.MID AND a.FunID = b.FunID
-- and b.UID = 44 and a.MID=904 )>0 then 'Tree' else 'False' end )
and b.UID = 44 )>0 then 'True' else 'False' end ) ,
a.FID,a.MID,a.FunID,a.Memo FROM dbo.tbSysPurviewMenu a
WHERE a.MID=904
SELECT (select case when (SELECT isnull(b.FID,0) FROM dbo.tbUserPact b
WHERE a.FID = b.PactID
and b.UID = 129 and b.MenuID=103 )>0 then 'True' else 'False' end )as YnUse ,
a.FID,a.PtrID,a.SN,a.PactMySN,a.PactName,a.Memo
FROM dbo.tbDevPactList a
WHERE a.PtrID=2 and a.YnUse ='True'