SELECT MAX(i.PUID),
  MAX(i.PITEM_ID),
  MIN(Ir.PITEM_REVISION_ID),
  Ir.RSEQUENCE_ANCHORU
FROM Infodba.Pitemrevision Ir
INNER JOIN infodba.PITEM i
ON i.PUID = Ir.RITEMS_TAGU
GROUP BY Ir.RSEQUENCE_ANCHORU
HAVING MAX(i.PUID) IN
  (SELECT i.PUID
  FROM infodba.Pitemrevision ir
  INNER JOIN Pitem i
  ON ir.RITEMS_TAGU = i.PUID
  WHERE i.PITEM_ID LIKE 'Item0%'
  )