🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.vdbase.data.sql
Article #942

Re: Aggregate functions on rowsets

#942
From: EDDIE SHUM
Date: Thu, 04 Jun 1998 00:00
59 lines
3282 bytes
Ken Mayer [TeamB] wrote:
> 
> EDDIE SHUM <econshum@netvigator.com> wrote:
> 
> >Say, for example, you have a SQL table containing data on name of
> >students, Place of birth (like a given state in the US) and their text
> >score.  Suppose you want to know what is the average score for students
> >born in Kansas.  In your applicatin, you would normally carry out a
> >filter with the help of the data button components provided by VDB7
> >which are very good.  Now, you have a subset of your original rowset or
> >a sub-rowset.  What is OODML function or command for doing sum, average,
> >etc.?
> >
> >I have tried the "calculate aggregates" function in VDB7 and it always
> >returns the result for the whole rowset and not a subset.  Could someone
> >shed some light on this?
> 
> This is off the top of my head, but try something like:
> 
> select avg( somefield ) from tablename where bornInfield = 'Kansas'
> 
> Ken
> ---
> Ken Mayer [TeamB]
> Golden Stag Productions
> http://www.mindspring.com/~hirschv/homepage.htm
> http://www.mindspring.com/~hirschv/dbase/dbase.htm
> 
> Please respond in the newsgroup unless explictly asked otherwise
Thank you for the reply, Ken.

I am afraid my last question was not put in the correct syntax.  I am
familiar with the SQL command in doing average or other aggregate
functions.  In fact, I am very surprised to learn that this type of
question has not been asked by somebody else before.

Say, Ken Mayer sells an application to UCLA.  In this application, there
are many tables.  Some of the fields are numeric.  Since a table
contains many different types of information, users will do at some
stage a data filtering and thereby generating a new rowset.  Now, your
users are going to want to know what is the new averages, sums for this
new rowset.  

VDB7 provides a very good way to locate or filter data, i.e., the data
buttons in the component pallett.  The data buttons will automatically
do a locate or filter job on any of the fields on the primary rowset. 
It's where I am having problem.  Once the data are filtered, the
averages, sums whatever on the resulting rowset are still for the
original or the entire rowset.  Someone told me that EXCEL has the same
problem.  But in VDB 5.5 or earlier, this is not a problem.  Of course,
may be then, I was not working with rowset but records.

To put it simply, everyone must be interested in the averages, sums of
every rowset.  It's no good to tell your users to open the command
windows and to type in their SQL commands.  I don't think your users are
going to be very impressed with that.

Hope my question is clearer this time.
Technical Details
Message-ID: <3575FC78.34FA@netvigator.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3573C716.5B3C@netvigator.com> <35749c82.3632442@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: ff5a1,b9032b9bcf80acce
X-Google-Attributes: gidff5a1,public
From: EDDIE SHUM <econshum@netvigator.com>
Subject: Re: Aggregate functions on rowsets
Date: 1998/06/04
Message-ID: <3575FC78.34FA@netvigator.com>
X-Deja-AN: 359339780
Content-Transfer-Encoding: 7bit
References: <3573C716.5B3C@netvigator.com> <35749c82.3632442@forums.borland.com>
Mime-Version: 1.0
Reply-To: econshum@netvigator.com
Content-Type: text/plain; charset=us-ascii
Organization: ECON CONSULTANCY LTD.
Newsgroups: borland.public.vdbase.data.sql