Condense mulitple lines

jquickuk

Registered User.
Local time
Today, 15:20
Joined
Mar 18, 2009
Messages
12
Afternoon all,

I have a problem that I hope you guys can help with.

I recieve a stock extract each morning and could contain mulitple lines of the same item but with different stock levels.
What I need to be able to do using a either a query of using VB is to get one line per item but with the sum of the stock levels.

currently:

STOREIP IPSKU IPATP Field1 Field2 Field3 Field4 .......
0425 123456 2 xxx xxx xxx xxx .......
0425 123456 8 xxx xxx xxx xxx .......
0425 123456 1 xxx xxx xxx xxx .......


Needs to be:

STOREIP IPSKU IPATP Field1 Field2 Field3 Field4 .......
0425 123456 11 xxx xxx xxx xxx .......

The IPATP is the stock value and the IPSKU is the repeated line.

I have tried using the GroupBy and Sum functions on the query builder but it doesn't let me have all the other fields. Just the IPSKU which is set to GroupBy and IPATP which is Sum.

Any help will appriacated.
 
Group By on item, Sum on stock
Then join this query back to the other fields on item.
 
Right well I'll be honest feel a bit of a tit now.

Did the Group By and Sum query then linked it to the table and by using DISTNICT it work fine!!

That will clear about half a million lines from the table!!!!
 

Users who are viewing this thread

Back
Top Bottom