Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Stumped: sub-select with TOP
Message
De
08/02/2005 17:50:09
 
 
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:
00984966
Vues:
24
>The TOP clause must have GROUP BY. Which I added in the subquery but it still gives me an error.

I believe that is misinformation. I've never used it that way.

Looks like you will have to create a user-defined function to solve your problem until VFP9 gets here.
select KEYFIELD, CUST_ID, ORD_DATE, ORD_TIME 	;
from ORDERTABLE					;
where KEYFIELD == GetLatestOrderKey(CUST_ID)	;
order by CUSTOMER

procedure GetLatestOrderKey
lparameter	tcCUST_ID
local array	laKeys[1]	
select top 1 KEYFIELD from ORDERTABLE 		;
where CUST_ID == tcCUST_ID			;
order by ORD_DATE, ORD_TIME descending		;
into array laKeys
return laKeys[1]
I tested this.

>Thank you for your help.

Always glad to pay back for all the good help I get here.

Peter
Peter Robinson ** Rodes Design ** Virginia
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform