>select min(flg1) as flg1, EmpNo,min(SUM_SUM_TO) as SUM_SUM_TO,; >max(iif(flg1='A',SUM_SUM_TO,0)) as A1, ; >max(iif(flg1='B',SUM_SUM_TO,0)) as B1, ; >max(iif(flg1='C',SUM_SUM_TO,0)) as C1, ; >max(iif(flg1='D',SUM_SUM_TO,0)) as D1 from TWW GROUP BY EmpNo ORDER BY EmpNo > >INDEX ON EMPNO TO AA >BROW >I am not sure I understand what do you mean. Does the query produce correct result? If not, what data do you have and what do you get with this query?