Hi,

I have a system that imports data from a textfile weekly, it then returns all faulty rows to the source.

The system contains pricing data and agreement dates.

One of many faults can be faulty "split". A split occurs when a part is bought for example 40% from one
manufacturer and 60% from another. There can also be different prices for different months from the same manufacturer.
manufacturer.

I use "AGR_DATE_FROM+AGR_DATE_TO+PN+FACTORY+[QTYFROM/DATEFROM]+[QTYTO/DATETO]" as unique indentifier for each row.

AGR_DATE : The date for the agreement.
PART_NUMBER: Unique number for this part
FACTORY: Where it's manufactured
QTY/DATE : A part can have a different price for different dates or for different quantities.

----

I have constructed a sp that spits out all faulty rows where the total split is not 100%. But the logic
fails when there is more than two suppliers during a period. It very seldom is but it occurs from time to time.

Example that fails:

AGR_ID.AGR_DATE_FROM.AGR_DATE_TO.PN.........FACTOR Y.SPLIT.DATE_FROM..DATE_TO......PRICE
AA11....2004-01-01........2004-12-31....456545/1.FACT1....40.....2004-01-01...2004-02-29...2,8
AA11....2004-01-01........2004-12-31....456545/1.FACT1....40.....2004-03-01...2004-03-31...3,25
AA11....2004-01-01........2004-12-31....456545/1.FACT1....40.....2004-04-01...2004-06-30...3,6
AA11....2004-01-01........2004-12-31....456545/1.FACT1....40.....2004-07-01...2004-09-30...3,6
AA12....2004-01-01........2004-12-31....456545/1.FACT1....40.....2004-10-01...2004-12-31...3,8
AA13....2004-01-01........2004-12-31....456545/1.FACT1....60.....2004-01-01...2004-03-31...2,6
AA13....2004-01-01........2004-12-31....456545/1.FACT1....60.....2004-04-01...2004-06-30...3,1
AA13....2004-01-01........2004-12-31....456545/1.FACT1....60.....2004-07-01...2004-09-30...3,1
AA13....2004-01-01........2004-12-31....456545/1.FACT1....60.....2004-10-01...2004-12-31...3,1

----

In this case the rows are NOT faulty but gets spit out...
I have omitted my sp because I want some fresh input

The function I'm after is to delete all rows on one partnumber where the total split during the
agreement dates is not 100%

Can anyone help me? Because I've got a splittingheadache...