Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL statement problem ?
Message
De
04/11/1998 14:28:21
 
 
À
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:
00154469
Vues:
15
>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?
Sorry, the last SELECT wasn't good enough:
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 NVL(tmp1.item_name,tmp2.item_name) AS item_name, ;
  tmp1.quantity,tmp2.quantity2 ;
  FROM tmp1 FULL JOIN tmp2 ON tmp1.item_name=tmp2.item_name ;
  INTO CURSOR tmp3
Edward Pikman
Independent Consultant
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform