>It seems you're correct. If I eliminate everything but 9 joins, it works fine. But I was under the impression after looking at the documentation that a subquery would be another SQL Select statement encased in () and would be in a WHERE clause. Very confusing. I don't guess you know if SQL Server has the same limitations do you?
Travis,
On another branch of this thread I read that you're trying to provide a grid for the user to "view" the data in a sortable fashion. Unfortunately couldn't read all the messages so these might already be suggested :
Option 1) Use a custom header that indexes (if not already) on its controlsource and sets order tag to it.
Option 2) Instead of VFP grids use Activex MS DataGrid control. There are 2 Datagrid controls, Flexgrid and Hierarchical FlexGrid. You can use Activex ADO Data control to load a cursor or "shape" cursor and set Datagrid.datasource to ADO.recordsource. With flexgrid you could provide the "sorting" grid (user drag&drops the column to another position and column order specifies sort order - ie: by Company, then by Contact). With Hierarchical FlexGrid I don't know how to sort (or does it make sense to sort) but you can show the data like a "treeview grid". When a parent record level "collapsed" it has a "+" in its linker column. You can expand individual parents and columns for its children show up (no child column data when collapsed). Merging of cells provide a "look" like data grouping.
Option 2 is slow at init where ADO data is loaded but I like its outcome.
Cetin