Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Stumped: sub-select with TOP
Message
 
 
To
08/02/2005 16:45:46
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00984923
Message ID:
00984948
Views:
27
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--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform