Home » SQL & PL/SQL » SQL & PL/SQL » two counts???
two counts??? [message #2148] Mon, 24 June 2002 12:40 Go to next message
nt
Messages: 1
Registered: June 2002
Junior Member
i have a problem when trying to use two counts in oracle.
there are 2 tables:
machine ( machine_nr, machine_name)
is_trained(worker_name, machine_name)

now i want to write a query that puts out all machines (machine_name) where the existing number is higher than the number of workers who are trained on the machine and the number of machines AND workers.

i really hope that someone can help me with that problem.
thank in advance
Re: two counts??? [message #2195 is a reply to message #2148] Thu, 27 June 2002 03:20 Go to previous message
Niranjan
Messages: 34
Registered: June 2001
Member
--try this one
-- I have assumed that machine_name typed in machine
-- and is_trained are alike.

select m.machine_name,m.mc_cnt,t.wk_cnt from
(select machine_name,count(*) mc_cnt from machine group by machine_name) m,
(select machine_name,count(*) wk_cnt from is_trained group by machine_name) t
where m.machine_name = t.machine_name(+) ;
Previous Topic: 8i DBA +MCSA
Next Topic: simple =(+)
Goto Forum:
  


Current Time: Thu Apr 25 16:57:04 CDT 2024