>>That would work too. I guess, I wasn't clear in my previous message. You could change UNION to UNION ALL and it would work. UNION should be only used in the queries that could produce duplicate records, to eliminate those duplicates. UNION ALL is also faster because it doesn't do anything with result set. UNION, on other hand, does DISTINCT on the result set. That's where VFP generates an error on memo fields because it doesn't compare them for performance reason.
>
>I never realized that. That means, that in some cases, I could have eliminated the use of GROUP BY. I guess the UNION will use the first field for that detection.
I'm not sure, I understand you. UNION uses all fields to compare records to eliminate duplicates. UNION ALL doesn't compare them at all. It's just joins separate queries results into one record set (cursor).
--sb--