Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Update incoming rows based on % calculation

Author  Topic 

SujitGouda
Starting Member

3 Posts

Posted - 2015-03-13 : 13:39:45
I have below records coming in from source files

ProdName Amount TranType
P1 100 A
P1 100 S
P2 200 A
P2 205 S

In case the ProdName is same, and Amount = or (within +/- 5%) of Amount, I have to update the TranType column as IN/OUT respectively as shown below in the tables.
I am okay with using 2 different tables if needed as in the records comes in one table and then i can reference that table to upload the values in another.

ProdName Amount TranType
P1 100 IN
P1 100 OUT
P2 200 IN
P2 205 OUT

Can anyone help me with this ??? This is very urgent. The order of the records coming in can be different order, they need not be subsequent.

This is happening in SQl Server 2008.

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2015-03-13 : 16:21:08
duplicate
Go to Top of Page
   

- Advertisement -