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: SubQuery Question

Re: SubQuery Question

From: its not me <it.is_at_not.me.com>
Date: Sat, 19 Feb 2005 01:00:06 +0000
Message-ID: <1o3d111foevsi4gt8lj5e58o14ii1cetme@4ax.com>


On 18 Feb 2005 01:13:45 -0800, "Paul Izzo" <paul.izzo_at_mosca-ag.com> wrote:

>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.
eg:
SELECT t.*

      ,w.*
FROM workorders w

      ,tasks t
WHERE w.order_id = t.order_id
AND 4 = (SELECT COUNT (t2.task_id)

            FROM   fundgroups t2
            WHERE  t2.order_id = w.order_id)

 Posted Via Usenet.com Premium Usenet Newsgroup Services


Received on Fri Feb 18 2005 - 19:00:06 CST

Original text of this message

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