Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Yuri Rubinov
  Where is Yuri Rubinov?
 Philadelphia
 Pennsylvania - United States
 Yuri Rubinov
 To: Leonard Trevor
  Where is Leonard Trevor?
 Edinburgh
 United Kingdom
 Leonard Trevor
 Tags
Subject: RE: grouping output
Thread ID: 248950 Message ID: 248958 # Views: 1 # Ratings: 1
Version: Visual FoxPro 6 Category: Databases, Tables and SQL Server
Date: Friday, December 25, 2009 10:42:21 PM         
   


> Dear expert,
>
> The following data has to be grouped to generate a single line output.
>
> The difference between the various amounts within each grade is the same.
>
> grade notch amt
> -------------------
> AM 1 10
> AM 2 30
> AM 3 50
> AM 4 70
>
>
> AC 1 40
> AC 2 55
> AC 3 70
> AC 4 85
>
>
> expected result
> --------------
>
>
> grade min_amt max_amt difference
> ---------------------------------------------------------
> AM 10 70 20
> AC 40 85 15
>
>
>
> Pls provide a select statement to enable me generate the expected result
>
> Thanks
>
> Merry Christmas to all.

For instance:

SELECT ;
	grade,;
	MIN(amt) min_amt,;
	MAX(amt) max_amt,;
	(MAX(amt)-MIN(amt))/(COUNT(*)-1) ndifference;
	FROM yy GROUP BY 1


Best Wishes,

Yuri Rubinov

ENTIRE THREAD

grouping output Posted by Leonard Trevor @ 12/25/2009 9:58:08 PM
RE: grouping output Posted by Yuri Rubinov @ 12/25/2009 10:42:21 PM