Joe Yoder wrote: > Thanks Ricardo - The code you suggest gives me some ideas of how to > approach the combined statement. Unfortunately there are apparently some > errors in the code that I have not been able to correct. I like the way > you broke up the statement to make it understandable but I'm afraid it > will need to work before I really understand it. > > Thanks again - Joe > Sorry Joe, it was untested. Most of it would work in SQL server's SQL. I think in foxpro 9 you can also embed subqueries, that's why I suggested it. Breaking up the statements that way has proven invaluable to me when coding long and complicated queries. Nowadays whenever I have to look at someone else's query I format it before doing anything else, it helps a lot. As for the query the only suggestion I could make without seeing the errors is to use "family.Id" instead of "Id" in the "On" statements. You can get away not including the table reference if the name of the field is unique, but if the query is big enough you end up having references to fields and not knowing in which table they are. Another thing is that you'll get null values in Typ# and Job# fields, you might want to use NVL() function there (IsNull if you are working with SQL server). And I just noticed you are using both "==" and "=" in the conditions of the "On" statements. One of them MUST be wrong (I'd say the "==").
HTH _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[email protected] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

