Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Help with subquery
I am having difficulty with what should be a simple query. I have two tables; Inventory Parts and Customer Orders. I want select the total Qty_On_Order for all parts. I assume I need to do a SELECT on the parts, with a subquery to sum the orders. Is there a better way?
In my statement below, I cannot get it to return all item numbers unless I hard code the number. I cannot replace the '11508' with i.part_no.
select i.part_no, i.description, ooo.Qty_On_Order from
inventory_part_tab i,
(select col.part_no,sum(col.Qty_On_Order) as Qty_On_Order from
ifsapp.customer_order_line_tab col
where col.part_no = '11108' group by col.part_no) ooo
where i.part_no = ooo.part_no
Make sense? Thanks. Received on Thu May 31 2001 - 13:28:01 CDT
![]() |
![]() |