Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL vfp 8 vs. vfp 6
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00815861
Message ID:
00816700
Views:
31
Hi Timothy,

Here's sample code that shows the porblem. As you can see with the same data but ordered differently you get different result. For detail=1, in case #1 noun='C', for case #2 it's 'A'.
SET ENGINEBEHAVIOR 70
* #1
CREATE CURSOR bsyear03 ( ;
	detail i, noun C(1), quantity i) 
INSERT INTO bsyear03 VALUES( 1, "A", 10)
INSERT INTO bsyear03 VALUES( 1, "B", 20)
INSERT INTO bsyear03 VALUES( 1, "C", 15)
INSERT INTO bsyear03 VALUES( 2, "D", 30)
Select detail, noun,  sum(quantity) ;
  from bsyear03 group by detail 

* #2
CREATE CURSOR bsyear03 ( ;
	detail i, noun C(1), quantity i) 
INSERT INTO bsyear03 VALUES( 1, "C", 15)
INSERT INTO bsyear03 VALUES( 1, "B", 20)
INSERT INTO bsyear03 VALUES( 1, "A", 10)
INSERT INTO bsyear03 VALUES( 2, "D", 30)
Select detail, noun,  sum(quantity) ;
  from bsyear03 group by detail 

*Result 
 DETAIL NOUN SUM_QUANTITY
#1
      1 C              45
      2 D             105
#2
      1 A              45
      2 D             105
>Sergey, to make it more meaningful perhaps I would do this....
>select detail,noun,sum(price),sum(quantity) from s:bsyear01 group by detail;
>into cursor curs_abc
>INDEX On noun TO e:f
>copy to curs_xyz
>brow
>I see what you mean that the noun would be meaningless because only 1 record(noun) would show up for all records matching a certain detail.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform