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

Home -> Community -> Mailing Lists -> Oracle-L -> Re:

Re:

From: Leszek Ignaszak <leszek.ignaszak_at_post.pl>
Date: Mon, 30 Sep 2002 04:38:30 -0800
Message-ID: <F001.004DC429.20020930043830@fatcity.com>


try it:

select
  name
from
  (select c.name, count(p.id) p_count from clients c, projects p    where c.id = p.cl_id
   group by c.name) a,
  (select max(count(id)) p_max from projects     group by cl_id) b
where a.p_count = b.p_max

Regards,
Leszek

At 03:23 2002-09-30 -0800, you wrote:
>Hello all,
>
> I have a query ->
>i have 2 tables -> client and project
>
>fields in project table -> clientid/projectid
>fields in client table -> clientid/name
>
>i want to get the maximum orders one client has got. i mean a project
>having the greatest clients
>how to write it in single query ??
>
>
>like
>project 1 client 1
>project 2 client 1
>project 3 client 2
>
>in the above case, the query should return client ( 1 ).
>
>Thanks and regards,
>Santosh

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Leszek Ignaszak
  INET: leszek.ignaszak_at_post.pl

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Mon Sep 30 2002 - 07:38:30 CDT

Original text of this message

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