🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: SUM(QUESTION)

#1040
From: Keith G. Chuvala (TeamB)
Date: Wed, 13 May 1998 00:00
14 lines
1093 bytes
> SELECT I.DIVISION, I.COUNTRY, SUM(I.AMOUNT WHERE I.W = "1"), SUM(I.AMOUNT
> WHERE I.W = "2"), SUM(I.AMOUNT WHERE I.W = "3"),SUM(I.AMOUNT WHERE I.W =
> "4") FROM INPUT I


I think I understand what you're after.  Try this:

  select division,country,sum(amount) from input group by division,country

This will give you an answer table with the sum of Amount for each COUNTY
within each DIVISION.

kgc
Technical Details
Message-ID: <355A0F02.8DEC8988@DELETE_THIS.hit.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <6j8ia7$9br11@forums.borland.com> <3557DBDA.C21AD80@ibm.net> <6j9l9f$9vp14@forums.borland.com> <35590D45.A88DECC4@ibm.net> <35597071.447EAFE2@ibm.net> <6jcoho$d1v8@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: ff5a1,d5546114e3a7f07c
X-Google-Attributes: gidff5a1,public
From: "Keith G. Chuvala (TeamB)" <kgc@DELETE_THIS.hit.net>
Subject: Re: SUM(QUESTION)
Date: 1998/05/13
Message-ID: <355A0F02.8DEC8988@DELETE_THIS.hit.net>
X-Deja-AN: 352998148
Content-Transfer-Encoding: 7bit
References: <6j8ia7$9br11@forums.borland.com> <3557DBDA.C21AD80@ibm.net> <6j9l9f$9vp14@forums.borland.com> <35590D45.A88DECC4@ibm.net> <35597071.447EAFE2@ibm.net> <6jcoho$d1v8@forums.borland.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Organization: First Intermark Corp.
Newsgroups: borland.public.vdbase.data.sql