Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Elegant SQL
Message
De
11/05/2005 11:45:17
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Elegant SQL
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01012923
Message ID:
01012923
Vues:
63
Hi All:

Is there any way to consolidate the following code in to one SQL statement?
* table HATCINFO

* hi_chicks	hi_htchpct	hi_eggprice
* 9101		.8618			2.30	    
* 42413		.8033			1.95


SELECT hi_chicks / hi_htchpct as eggs, ;
hi_eggprice ;
FROM it!hatcinfo ;
WHERE hi_invnum = 'A0017' ;
AND !DELETED() ;
INTO CURSOR curs1

SELECT SUM(eggs) as sqTotalEggs, SUM(hi_eggprice * eggs) as sqTotalAmt ;
FROM curs1 ;
into CURSOR curs2

lnAggregatePrice = sqTotalAmt / sqTotalEggs

? lnAggregatePrice 
The lnAggregatePrice should equal 2.01.

Thanks!

Yossi
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform