Article View: borland.public.vdbase.data.sql
Article #1127SUM(QUESTION)
From: Keith A. Towell
Date: Tue, 12 May 1998 00:00
Date: Tue, 12 May 1998 00:00
46 lines
1777 bytes
1777 bytes
I have a database that has Countries within Divisions and categorized by
work areas.
What I want to do is get a SUM(AMOUNT) in each of the work areas 1-9 and
then group the by Division.
REPORT SHOULD LIKE LIKE
WORK1 WORK2 WORK3 WORK4
TOTAL
DIV1
COUNTRY1 10 10 10
10 40
COUNTRY2 20 10 20
40 90
TOTAL 30 20 30
50 130
DIV2
COUNTRY3 30 10 10
20 70
COUNTRY4 20 20 20
40 100
TOTAL 50 30 30
60 170
SOMETHING LIKE:
SELECT SUM(I.AMOUNT) FROM INPUT I
WHERE DIVISION = 1 AND COUNTRY = 1 AND WORK = 1
would get me the first number, but is there any way to get a single
statement to get all of the numbers?
I know in the report program I can group by division? So that is un
important. My result coult look like a database like this
DIVISION=DIVISON
COUNTRY=COUNTRY
SUM_01=SUM(AMOUNT) FOR WORK = 1
SUM_02=SUM(AMOUNT) FOR WORK = 2
SUM_03=SUM(AMOUNT) FOR WORK = 3
SUM_04=SUM(AMOUNT) FOR WORK = 4
TOTAL
Technical Details
Message-ID:
<6j8ia7$9br11@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: ff5a1,d5546114e3a7f07c,start X-Google-Attributes: gidff5a1,public From: "Keith A. Towell" <katowell@1stConnect.com> Subject: SUM(QUESTION) Date: 1998/05/12 Message-ID: <6j8ia7$9br11@forums.borland.com> X-Deja-AN: 352433987 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 Organization: Another Netscape Collabra Server User Newsgroups: borland.public.vdbase.data.sql