Lists people and how much they’ve been using specified software with OU fix

For full details see: http://www.myitforum.com/forums/tm.aspx?high=&m=234978&mpage=1#234980

select 
  U.Name0 as 'Bruger', 
--  U.displayName0 as 'Bruger', 
  MU.FullName as 'Brugernavn', 
  ou.ou as OU, 
  round(sum(MUS.UsageTime)/60.0,2) as 'Forbrug (min)' 
from 
  dbo.v_R_System R
  join dbo.v_MonthlyUsageSummary MUS on R.ResourceID = MUS.ResourceID 
  join dbo.v_MeteredFiles MF on MUS.FileID = MF.MeteredFileID 
  join dbo.v_MeteredUser MU on MUS.MeteredUserID = MU.MeteredUserID 
  join dbo.v_R_User U on U.Unique_User_Name0 = MU.FullName 
  left join (select OU.ResourceID, replace(max(ou.User_OU_Name0),'Gartek.LOCAL/Ottawa/','') as OU  from  v_RA_User_UserOUName OU group by  OU.ResourceID) as OU on OU.ResourceID = U.ResourceID 
where 
  MF.ProductName = @RuleName 
Group by 
  U.Name0,
  MU.FullName, 
  ou.ou
 order by  
  U.Name0



email

Written by , Posted .