IF NOT loDMA.SQLExec('SELECT Country.Numero,Country.'+gcReturnTitle+' AS Title,Temp.SchoolTotal FROM '+; '(SELECT School.NoCountry,COUNT(*) AS SchoolTotal FROM School WHERE School.Status=2 GROUP BY 1) Temp '+; 'INNER JOIN Country ON Temp.NoCountry=Country.Numero '+; 'ORDER BY 2') RETURN loDMA.cHtml ENDIFBut, doing this same sub select in ODBC, generates a result of -1. There seems to be some incompability in the syntax in this SQL. Anyone would know how I can adjust to have something generic?