>>Create a cursor with field names, aFields() then append from array for each table, then generate the SQL statement from that cursor. Not the most elegant way to do it, but there it is. Sorting... you may try to cook up something based on the order of fields in the first table, maybe assigning an extra field for the first table, then ordering by field name, then applying that marker to all other fields of the same name... couple of hours of fun.
>
>Thanks Dragan. This one has been set aside for a while when I have more time.:)
Well, your requirements sounded like something to have fun with for a day or two. And as they say, the day has 24 hours (actually, this is US, it has 12 and 12 hours) and the night, and the week has seven days and the weekend...