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: andrewst <member14183_at_dbforums.com>
Date: Wed, 02 Apr 2003 16:27:28 +0000
Message-ID: <2720659.1049300848@dbforums.com>

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;

--
Posted via http://dbforums.com
Received on Wed Apr 02 2003 - 10:27:28 CST

Original text of this message

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