Shadowx, You are very rigth in theory. I have thought along your idea, but it sounds complicated hence my coming to this board if there is a shorter approach to the problem. I still hope there is an inbuilt command or sql statement for this. It appears to be a common problem, and as such, would have attracted attension. Will you be kind enough to translate your idea into code (php)? Is foreach() a useful function for this? Regards, serialmike