List:General Discussion« Previous MessageNext Message »
From:Dan Nelson Date:December 6 1999 7:48pm
Subject:Re: Can't find this...
View as plain text  
In the last episode (Dec 06), Ronald Beck said:
> Hello all,

> I have a database for our pagers and one of the columns contains the
> monthly fee charged by the pager service.  What can I use to get a
> sub-total by department (yes, I have a department column too) and
> then a grand total of all charges?  I don't see an example of this
> type of query in Chapter 8 and I don't really know what to look for
> in the commands section.  I don't see any reference to generating
> totals in the SELECT definition.

In the simplest case, 

SELECT dept, SUM(amount) FROM pagercharges GROUP BY dept;

will total the 'amount' column for each department.  You'll need
another SELECT to pull the grand total, or calculate it yourself from
the results of the first select.

	Dan Nelson
Can't find this...Ronald Beck6 Dec
  • Re: Can't find this...Steve Ruby6 Dec
  • Re: Can't find this...Dan Nelson6 Dec
  • Re: Can't find this...Ronald Beck7 Dec
RE: Can't find this...daniel.gardner7 Dec