× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



What was requested was the one "finished item" with the MAXimum SUMmation of the Quantity values, not the MAXimum COUNT of items, for the noted combination\group of Component Item and Warehouse Id; i.e. Finished Item 7777A with the sum of quantities 45 were the requested data to be added to the query result set.

However I think it is at least somewhat moot, as I believe without the relationship to the fourth file being defined, the scenario remains too open to interpretation. What of the existing query uniquely identifies\selects the noted Component Item and Warehouse Id? Although the given query as reply might give a good idea how to accomplish the task, depending on how the warehouse identifier is related & the amount of data in the fourth file, that query could be an extremely poor performer. But for lack of details like DDL and DML, plus relationships and cardinality, a /good/ query is difficult to recommend.

Regards, Chuck

Charles Wilt wrote:
Here's a first pass.... <<SNIP>>

The problem with the above....if for instance you have
Component Warehouse Finished
Item Id Quantity Item
ABC123 N1 10 7777
ABC123 N1 15 7777
ABC123 N1 18 7777
ABC123 N1 25 7777A
ABC123 N1 7 7777A
ABC123 N1 13 7777A

Which finished Item do you want to chose? They both appear 3
times.

<<SNIP>>

On Mon, Apr 19, 2010 at 4:19 PM, <Peter_Vidal@xxxxxxxx> wrote:
<<SNIP>>

What I want is (by using the component item and the warehouse id) to pull in the FINISHED ITEM that is most often associated with a component item (in this case, 7777A) and the total
QUANTITY for that FINISHED ITEM (in this case, 45 (25 + 7 +
13)). In addition, I want to include the file and this new
logic in this SQL Statement (that is currently running):

SELECT I.HOUSE, I.ITNBR, I.PLANIB,
R.ITCLS, R.ITDSC, R.ENGNO, R.ITTYP,
P.PODUD, P.POSTD, P.POQTY, P.PORID,
I.ACREC
FROM
ITEMBL I, ITMRVA R, PLNORD P
WHERE
I.ITNBR = P.POITM AND
I.HOUSE = P.POPLWH AND
I.ITNBR = R.ITNBR AND
I.ACREC = 'S' AND
R.STID = 'N1P' AND
(I.HOUSE LIKE 'N%')

Any ideas? Any help is greatly appreciated.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.