/* Description: erm. IrId Create + LastMod Date 30.08.2011 18:07 mod case for MSSql J.Fes */
/* Stand bis 30.08.2011 23:16
SELECT ir.pitem_revision_id AS IrRev,
  paoIr.plast_mod_date      AS IrLastModDate,
  paoIr.pcreation_date      AS IrCreateDate
FROM infodba.PITEMREVISION ir
INNER JOIN infodba.PPOM_APPLICATION_OBJECT paoIr ON (ir.puid = paoIr.puid)
WHERE ir.puid = :ir_puid
*/

SELECT ir.pitem_revision_id AS IrRev,
  paoIr.plast_mod_date      AS IrLastModDate,
  paoIr.pcreation_date      AS IrCreateDate,
--   s.pname                   AS IrOwningSite,
--   s.psite_id                AS IrOwningSite
  s.psite_id                AS IrOwningSite_TCE_pSite_ID
FROM infodba.PITEMREVISION ir
LEFT JOIN infodba.PPOM_OBJECT o on (ir.puid = o.puid)
LEFT JOIN infodba.PPOM_IMC s on (o.rowning_siteu = s.puid)
LEFT JOIN infodba.PPOM_APPLICATION_OBJECT paoIr on (ir.puid = paoIr.puid)
WHERE ir.puid = :ir_puid
