Thanks for your help.I got this to work for me.. Select Left(rh.CRDATTIM,10) as KEY_DATE, MID(rh.CRDATTIM,12,8) as KEY_TIME, RIGHT(rh.CRDATTIM,6) as KEY_MILSEC, rh.COMMDATTIM, rh.COMMTEXTFrom W21U999S rh, (SELECT max(COMMDATTIM) as maxtime, CRDATTIM FROM W21U999S GROUP BY CRDATTIM) maxresultsWHERE rh.CRDATTIM = maxresults.CRDATTIMAND rh.COMMDATTIM =maxresults.maxtimeAND rh.CODEM = 'M'Select rh.KEY_DATE, rh.KEY_TIME, rh.KEY_MILSEC, rh.EVENT_DATTIM, rh.LASTNAME, rh.FIRSTNAMEFrom WA5U999S rh, (SELECT max(EVENT_DATTIM) as maxtime, KEY_DATE, KEY_TIME, KEY_MILSEC FROM WA5U999S GROUP BY KEY_DATE,KEY_TIME,KEY_MILSEC) maxresultsWHERE rh.KEY_DATE = maxresults.KEY_DATEAND rh.KEY_TIME = maxresults.KEY_TIMEAND rh.KEY_MILSEC = maxresults.KEY_MILSECAND rh.EVENT_DATTIM =maxresults.maxtimeAND rh.STATCODE = 'PROCESSED'AND rh.EVENTCODE = 'BIUPDATW'SELECT KEY_DATE, KEY_TIME, KEY_MILSEC, COUNT(1) as "COUNTTXNS"FROM WB5U999SWHERE PRCCODE = 'T'GROUP BY KEY_DATE, KEY_TIME,KEY_MILSEC;