General discussion

Locked

Trouble Querying Database

By brian.m.waters1 ·
I have a table with a list of issues (includes duplicates) associated with a file name. There is a separate query that's linked to this table by file name and includes about 10 calculated fields associated with the file name (no duplicates). I would like to create a query that will add the 10 calculated fields together and sum them up by Issue#. Example:

Table#1
Issue# FileName
CR1 a.txt
CR2 a.txt
CR2 b.txt
CR2 c.txt

Table#2
FileName HrEst STEst BuildEst
a.txt 2 3 4
b.txt 1 4 6
c.txt 2 4 5

So for CR#1 I should get 9 and for CR#2 I should get 31. Understand? Any help would be GREATLY appreciatd. Thanks.

This conversation is currently closed to new comments.

1 total post (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by Gary_W In reply to Trouble Querying Database

This works in Oracle:

select sum(b.HREST+b.STEST+b.BUILDEST)
from gcw1 a, gcw2 b
where a.ISSUE = 'CR2'
and a.FILENAME = b.FILENAME

SQL> select sum(b.HREST+b.STEST+b.BUILDEST)
2 from gcw1 a, gcw2 b
3 where a.ISSUE = 'CR2'
4 and a.FILENAME = b.FILENAME;

SUM(B.HREST+B.STEST+B.BUILDEST)
-------------------------------
31

Gary

Back to Web Development Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums