Hi Cetin
>This code could be converted to your backend's style. In SQL2005 there is PIVOT but even with that first you should do your summing (otherwise PIVOT is just a wrapper for easier coding exploding to a series of sum(iif())).
>The code's inefficiency and pain of the effort to write it is obvious. Getting summed data into VFP and doing crosstabbing there (either with existing genxtab or your own xtabber) or doing that in a stored procedure/function of your backend would be better.
Thanks for the explanation.