CREATE VIEW VWPMO_TEMPLATE_ENTITY AS 
SELECT
	T.GUID AS TEMPLATE_ID,
	T.NAME AS TEMPLATE_NAME,
	T.TEMPLATE_PATH AS TEMPLATE_PATH,
	T1.GUID AS TEMPLATE_ENTITY_ID,
	T2.GUID AS ENTITY_ID,
	T2.NAME
FROM
	TBPMO_TEMPLATE T,
	TBPMO_TEMPLATE_ENTITY T1,
	TBPMO_FORM T2
WHERE
	T.ACTIVE = 1 AND
	T.GUID = T1.TEMPLATE_ID AND
	T1.ENTITY_ID = T2.GUID