Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL statement problem ?
Message
De
04/11/1998 14:14:59
 
 
À
04/11/1998 14:03:37
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00154383
Message ID:
00154464
Vues:
21
>i want to separate the result of the purchase sum(quantity)
>and sales sum(quantity)
>that means the result will look like
>
>item_name quantity1(purchase) quantity2(sales)
>printer xx xx
>harddisk xx xx
>
>how is the sql statement will look like?
SELECT stock.item_name,SUM(purchase.quantity) AS quantity1 ;
 FROM stock,purchase ;
 INTO CURSOR tmp1 ;
 WHERE stock.item_name=purchase.item_name ;
 GROUP by stock.item_name 
SELECT stock.item_name,SUM(sales.quantity) AS quantity2 ;
 FROM stock,sales ;
 INTO CURSOR tmp2 ;
 WHERE stock.item_name=sales.item_name;
 GROUP by stock.item_name;
SELECT tmp1.*,tmp2.quantity2 ;
 FROM tmp1 FULL JOIN tmp2 ON tmp1.item_name=tmp2.item_name ;
 INTO CURSOR tmp3
Edward Pikman
Independent Consultant
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform