/* Discription: Ermittlung aller IR's */
/*  Stand Original Abfrage: 22.07.2007 22:48 */

select -- distinct
  i.pitem_id As IrName ,
  ir.pitem_revision_id As IrRev ,
  ir.puid As IrPuid
from
  infodba.pitem i,
  infodba.pitemrevision ir
where
  i.puid = ir.ritems_tagu

/*
select -- distinct
  ir.puid                  As IrPuid ,
  i.pitem_id               As IrName ,
  ir.pitem_revision_id     As IrRev ,

  s.pname                  AS IrOwningSite,

  paoIr.PCREATION_DATE     AS IrCreateDate ,
  paoIr.PLAST_MOD_DATE     AS IrLastModDate ,
  puIrOwningUser.puser_id  AS IrOwningUser ,
  puIrLastModUser.puser_id As IrLastModUser ,
  pgIr.PNAME               As IrOwningGroup 
from
  infodba.pitem                   i,
  infodba.pitemrevision           ir,

  infodba.ppom_application_object paoIr,
  infodba.ppom_user               puIrOwningUser ,
  infodba.ppom_user               puIrLastModUser ,
  infodba.PPOM_GROUP              pgIr,

  infodba.ppom_imc                s ,
  infodba.ppom_object             o
where
      i.puid               = ir.ritems_tagu
  and puIrOwningUser.puid  = paoIr.rowning_useru
  and puIrLastModUser.puid = paoIr.rlast_mod_useru
  and pgIr.PUID            = paoIr.ROWNING_GROUPU
  and paoIr.PUID           = ir.PUID

  and o.puid               = ir.puid
  and o.rowning_siteu      = s.puid (+)
  */