Hi Fabio
Thanks for your replies. The query you suggested still raises the error:
SQL: Queries of this type are not supported.
If I remove the ORDER BY in the subquery I get:
SQL: TOP requires an ORDER BY.
Now I remove the TOP 1 in the subquery and I get:
Subquery returned more than one record.
I just put back in the ORDER BY in the subquery again:
SQL: The ORDER BY clause is invalid in subqueries, unless TOP is also specified.
I put back the TOP 1 also in the subquery and we are back to the original error:
SQL: Queries of this type are not supported.
I have tried this with engine behavior 70 and 90.
I also need to then later join the iPartyID from the subquery with the master table containing the name of the party.
What am I missing. Please advise.
>
>SELECT TD.*, ;
> mLookup.cValue AS cLevel1, ;
> mLookup_A.cValue AS cLevel2, ;
> mLookup_B.cValue AS cLevel3, ;
> (SELECT TOP 1 iPartyID ;
> FROM VSO3!sDocsParty SDP ;
> WHERE iPID = TD.iID ;
> ORDER BY iID) AS iPartyID ;
> FROM VSO3!tDocs TD ;
> LEFT JOIN VSO3!mLookup ;
> ON TD.ILvl1ID = mLookup.iID ;
> LEFT JOIN VSO3!mLookup mLookup_A ;
> ON TD.ILvl2ID = mLookup_A.iID ;
> LEFT JOIN VSO3!mLookup mLookup_B ;
> ON TD.ILvl3ID = mLookup_B.iID ;
> ORDER BY mLookup.cValue, mLookup_A.cValue, mLookup_B.cValue
>
>