I see you changed the query in your latest message. Somehow I don't see how using a variable and TEXTMERGE would bring up different results. I liked your previous suggestion; it was what I thought I was missing in my original post. And I thought that it would be the solution but somehow this error with "multi-part identifier C1.COMP_PK" got in the way. I wonder what exactly was wrong there. Thank you.
>Why don't you use TEXTMERGE?
>Try
>
>TEXT TO cSqlCommand NOSHOW
>select C1.*, C2.LASTNAME, C2.FIRSTNAME, C2.TELEPHONE1
> from COMPANY C1
> LEFT JOIN (SELECT LASTNAME, FIRSTNAME, TELEPHONE1, COMP_PK FROM PEOPLE p3
> WHERE ORDERNO = (SELECT MIN(ORDERNO) FROM PEOPLE p4 where p3.comp_pk =p4.comp_pk )) C2 ON C1.COMP_PK = C2.COMP_PK
>ENDTEXT
>
>
>>This is the exact copy of the query I have:
>>
>>
>>cSqlCommand = "select C1.*, C2.LASTNAME, C2.FIRSTNAME, C2.TELEPHONE1 from COMPANY C1 " + ;
>> " LEFT JOIN ( SELECT TOP 1 LASTNAME, FIRSTNAME, TELEPHONE1, PEOPLE.COMP_PK FROM
>>PEOPLE C3 " + ;
>> "WHERE C1.COMP_PK = C3.COMP_PK ORDER BY ORDERNO ) C2 ON C1.COMP_PK = C2.COMP_PK"
>>
>>
>>>Can you post your query?
>>>
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham