Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Combining two SELECTs (or two way averaging)
Hi, I just seem to solve this one nagging prob that seems really simple
(untimately it'll be used for a site I'm working on.)
Below are the queirs. Basically I'm trying to combine the first two so I can
make a neat print out.
I checked the math on the first two standalone queries and they check out
perfectly.
Is there any way to get the third one to work.
(The first two are just to show, the third one is what's in question.)
Thanks alot.
QUERYS:
COLUMN Avg_Salary FORMAT $9,999,999.99 HEADING "Avg. Salary"; COLUMN Avg_GPA FORMAT 9.99 HEADING "Avg. GPA";
SELECT Major, Avg(Salary) Avg_Salary
FROM L3_Student S, L3_Works_For W
WHERE S.StudSSN = W.StudSSN
GROUP BY Major;
MAJOR Avg. Salary ------------------------------ -------------- Art $63,333.33 CIS $79,000.00 Literature $10,000.00Zoology
$2,000.00
SELECT Major, Avg(GPA) Avg_GPA
FROM L3_Student
GROUP BY Major;
MAJOR Avg. GPA ------------------------------ -------- Art 3.60 CIS 3.67 Literature 3.00
2.50
SELECT Major, Avg(GPA) Avg_GPA, Avg(Salary) Avg_Salary
FROM L3_Student S, L3_Works_For W
WHERE S.StudSSN = W.StudSSN
GROUP BY Major;
MAJOR Avg. GPA Avg. Salary ------------------------------ -------- -------------- Art 3.53 $63,333.33 CIS 3.67 $79,000.00 Literature 3.00 $10,000.00 Zoology 3.00 $2,000.00 ======================================================
-- IslawReceived on Wed Apr 02 2003 - 09:23:20 CST