Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL statement problem ?
Message
From
04/11/1998 14:28:21
 
 
To
04/11/1998 14:03:37
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00154383
Message ID:
00154469
Views:
16
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform