ALTER SESSION SET NLS_COMP=ANSI;
alter session set NLS_SORT=BINARY_CI;

SELECT 
  MAX(PITEMREVISION.PSEQUENCE_ID),
  MAX(PITEMREVISION.PUID) as irpuid
FROM PITEMREVISION
WHERE PITEMREVISION.PITEM_REVISION_ID LIKE 'REv%' -- COLLATE LATIN1_GENERAL_CI_AS
 GROUP BY PITEMREVISION.RSEQUENCE_ANCHORU
