-- Licensed Materials - Property of IBM
--
-- BI and PM: CM
--
-- (C) Copyright IBM Corp. 2008, 2009
--
-- US Government Users Restricted Rights - Use, duplication or disclosure
-- restricted by GSA ADP Schedule Contract with IBM Corp.

-- Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
-- Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).


drop view CMOWNERCOUNT

create view CMOWNERCOUNT(OBJID, OWN_NUMBER) as 
   SELECT p2.OBJID, count(o.CMID)  
   FROM CMOBJECTS o left outer join CMREFNOORD2 p1 on p1.CMID = o.CMID
                    left outer join CMOBJPROPS1 p2 on p1.REFCMID = p2.CMID
   GROUP BY p2.OBJID
