Table 1 : Buyer
UserID Value
1 5000
Table 2 : Seller
UserID Value
1 2000
2 1500
3 4000
so here is case im a buyer want to buy 5000 point from a seller so i trade in market and fill form order. and then then backend will be proceed to my 5000 order to a seller logic is im order 5000 and seller with ID 1 i got 2000 (-3000) seller with ID 2 i got 1500 (-1500) seller with ID 3 i got 1500 ( 0 = i got my 5000 point)
and then seller with ID 3 that data will be updated to 2500 and seller with ID 1 and 2 will be 0 or i added status field is success. Can someone help, what query should I make to get that?
thanks