Solved
SQL quiry assistance needed
Posted on 2007-11-23
Hello,
I am trying to create a small program that will calculate commission using php mysql.
I have a user import a data to the mysql database and I need to display acutall commission as a result.
I have a table commission.
Table has 1 column: Company Name, Profit for the month, Month.
Calculation as follows.
(Current Month Profit - Last Month profit) * 0.2
Sample Data Bellow
account_id company_name minutes profit revenue cost time_frame
983348 Company 1 1731.5 14.43 150.4 135.97 10
983349 Company 2 108744.92 701.65 7304.63 6602.98 10
983350 Company 3 168625.77 762.69 6851.39 6088.7 10
983358 Company 1 1783.02 14.53 153.02 138.49 11
983359 Company 2 277170.65 1375.36 7944 6568.65 11
983360 Company 3 286652.4 1428.12 24341.75 22913.63 11
Result Need to see:
Month November
Company Name Commision
Company 1 0.02
Company 2 134.742
Company 3 133.086
Thanks in advance,
Roman