>I just tested to build a SELECT with so many JOINs as the MAX() number of Synonyms in Synonym table. Something like:
>
>CREATE CURSOR Test (Fld1 I)
>CREATE CURSOR Test1 (Fld1 I, FLd2 M)
>FOR asd = 1 TO 76
> INSERT INTO Test VALUES (asd)
> INSERT INTO Test1 VALUES (asd%4+1, REPLICATE([a],asd))
>NEXT
>SELECT MAX(test) AS test;
> FROM (SELECT Fld1, COUNT(*) AS test;
> FROM Test1;
> GROUP BY Fld1) Tbl1;
>INTO CURSOR crsTest
>
>lcStr = [SELECT Test.Fld1,MAX(]
>lcJoin = []
>FOR lnFor = 1 TO crsTest.Test
> lcStr = lcStr + IIF(lnFor>1,[+],[]) + [NVL(","+ALLTRIM(Tbl]+TRANSFORM(lnFor)+[.Fld2),"")]
> lcJoin = lcJoin + [ LEFT JOIN Test1 Tbl]+TRANSFORM(lnFor)+[ ON Test.Fld1 = Tbl]+TRANSFORM(lnFor)+[.Fld1]
>NEXT
>lcStr = lcStr + [) AS TestMe FROM Test ]+lcJoin+[ GROUP BY Test.Fld1 INTO CURSOR crsTte]
>_cliptext =lcStr
>&lcStr
>
>But this almost block my computer :o), in VFP working with NATIVE tables :-).
Thanks, but as I mentioned in the other message, this is under OleDb so I am looking for SQL only approach such as having everything in one SQL instead of doing one to get the styles and 76 other SQLs to get the synonyms.