Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Combining two SELECTs (or two way averaging)

Re: Combining two SELECTs (or two way averaging)

From: Islaw <islaw_at_adexec.com>
Date: Thu, 03 Apr 2003 06:24:23 GMT
Message-ID: <rsQia.433$9I2.31400124@newssvr21.news.prodigy.com>


andrewst wrote:
> Originally posted by Islaw
>> 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.
>>
> Try this:
>
> select m1.major, m2.avg_gpa, m1.avg_salary
> from
> ( select major, avg(salary) avg_salary
> from l3_student s, l3_works_for w
> where s.studssn = w.studssn
> group by major
> ) m1,
> ( select major, avg(gpa) avg_gpa
> from l3_student
> group by major
> ) m2
> where m1.major = m2.major;

Thanks, that makes perfect sense actually! I made sure I understood it before trying to adapt it. I am still learning this though I've come a long way ;p

Many thanks.

--
Islaw
Received on Thu Apr 03 2003 - 00:24:23 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US