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

Home -> Community -> Usenet -> c.d.o.server -> Re: Subquery Question

Re: Subquery Question

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Sat, 19 Feb 2005 11:57:18 +0000 (UTC)
Message-ID: <cv79iu$1qc$1@sparta.btinternet.com>

As a starting point, you could hack around the following - which assumes there is a suitable pk/fk link between the two tables.

select

    {work_order_details}
from

    work_order_table wo
where

    4 = (

        select count(*)
        from tasks_table t
        where t.work_order_id = wo.work_order_id
    )
;
-- 
Regards

Jonathan Lewis

http://www.jlcomp.demon.co.uk/faq/ind_faq.html
The Co-operative Oracle Users' FAQ

http://www.jlcomp.demon.co.uk/seminar.html
Public Appearances - schedule updated Jan 21st 2005






"Paul Izzo" <paul.izzo_at_mosca-ag.com> wrote in message 
news:1108717921.003641.33470_at_z14g2000cwz.googlegroups.com...

>I have 2 tables that contain Schedule information. The first table
> contains Work Order's and the second table contains Task information.
>
> A given Work Order is composed of any combination of Tasks. Example:
>
> Work Order = Car
> Task 1 = Wheel Install
> Task 2 = Wheel Install
> Task 3 = Wheel Install
> Task 4 = Wheel Install
>
> What I'm looking for is a way to find all Work Orders that contain only
> 4 tasks. There's no feild in the tables that specify how many Tasks are
> part of a Work Order.
>
> I have the feeling in my gut that I need to do this query using a
> subquery. My only problem is that I don't know how to filter out Work
> Orders with less than 4 Tasks as well as those with more than 4 Tasks.
>
Received on Sat Feb 19 2005 - 05:57:18 CST

Original text of this message

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