Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Stumped: sub-select with TOP
Message
 
 
À
08/02/2005 16:45:46
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00984923
Message ID:
00984948
Vues:
28
It's VFP8 and earlier subquery limitation. Should work fine in VFP9.

>I'm trying to help Dmitry in the 'Can this be done...' thread.
>
>It seems like the following SQL statement should do what he wants but it gets the error "Command is missing required clause".
>
>
>select KEYFIELD, CUST_ID as CUSTOMER, ORD_DATE, ORD_TIME 	;
>from ORDERTABLE	;
>where KEYFIELD in	;
>(select top 1 KEYFIELD from ORDERTABLE where CUST_ID == CUSTOMER order by ORD_DATE, ORD_TIME descending)
>order by CUSTOMER
>
>
>The sub-select works fine by itself.
>
>I simplified the statement this way but it still gets the error.
>
>select ORDERTABLE.KEYFIELD, ORDERTABLE.CUST_ID as CUSTOMER, ORDERTABLE.ORD_DATE, ORDERTABLE.ORD_TIME 	;
>from ORDERTABLE	;
>where KEYFIELD in	;
>(select top 1 ORDERTABLE.KEYFIELD from ORDERTABLE order by ORD_TIME )
>
>
>If I substitute ALL for TOP 1, the error goes away.
>
>Any ideas?
>
>Peter
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform