Suppose I have a table that stores transactions between structured companies in each line:
Buyer ID | (Int.) Vendor Id | (Float) transaction amount I want to take a special company ID and find out which company will have the most unilateral net transaction history with them. For example, Company A has an ID of 100. I have to find out which company buys the highest net worth of sales. If the table data is as follows:
buyer ID seller transaction payment 100 100 200 10.00 200 100 5.00 100 300 1.00 Company 100 $ 10.00 is purchased 200, and Company 200 has bought goods 100 to $ 5.00 for total net transaction value of $ 5.00. Company 100 has a pure transaction value of 1.00 with company 300, but it is less than $ 5 and I am more interested here.
Is there a MySQL query, I would like this $ 5.00 amount ($ 10.00 + (- $ 5.00)) where the value of transaction can be changed by positive / negative based on the amount / field Based on which company is a buyer and which company vendor? Or do I need to bring all the relevant rows and calculate this maximum in the code?
Thank you!
You can use this simple solution:
Which has high net transaction value with this particular company (100): Select
if (SAIS (if buyer id = 100, transaction amount, transaction invalid '-1)) For transactions with SX NET SIM, where 100 IN (Buyer ID, Vendor ID Group) by another company, Net Suem DESC Limited 1
By the way, I like your username) =)
Comments
Post a Comment