This topic is locked

Calculating totals

1/3/2007 3:09:53 AM
PHPRunner General questions
D
dalimi author

I created a table and used the following query calculations. How can I deuct `Total Col HUD` from `LO Commission` to get `OfficeProfit`? I tried using `Total Col HUD` - `LO Commission` as `OfficeProfit` and it doesn't work. Can someone help me out. My sql is setup below. Please help <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=4291&image=1&table=forumtopics' class='bbc_emoticon' alt=':(' />
select `Date`,

`Loan Number`,

`Investor`,

`Loan Officer`,

`Borrower Last Name`,

`Broker Chk Rcd`,

`Admin Fee`,

`Admin Fee 2nd TD`,

`Appraisal Fee`,

`Credit Report Fee`,

`Processing Fee`,

`Processing Fee 2nd TD`,

`Origination Fee`,

`Application Fee`,

`Misc Fee`,

`YSP Rebate`,

`Deduction Off the Top`,

`LO Split`,

`ID`,

`Notes`,

`Admin Fee` + `Admin Fee 2nd TD` + `Appraisal Fee` + `Credit Report Fee` + `Processing Fee` + `Processing Fee 2nd TD` + `Origination Fee` + `Application Fee` + `Misc Fee` + `YSP Rebate` - `Deduction Off the Top` as `Total Col HUD`,

(`Admin Fee` + `Admin Fee 2nd TD` + `Appraisal Fee` + `Credit Report Fee` + `Processing Fee` + `Processing Fee 2nd TD` + `Origination Fee` + `Application Fee` + `Misc Fee` + `YSP Rebate` - `Deduction Off the Top`) * `LO Split` / 100 as `LO Commission`,

`Total Col HUD` - `LO Commission` as `OfficeProfit`

From `_Brokered_Loans_CR`

Sergey Kornilov admin 1/3/2007

select ...

`Admin Fee` + `Admin Fee 2nd TD` + `Appraisal Fee` + `Credit Report Fee` + `Processing Fee` + `Processing Fee 2nd TD` + `Origination Fee` + `Application Fee` + `Misc Fee` + `YSP Rebate` - `Deduction Off the Top` -

((`Admin Fee` + `Admin Fee 2nd TD` + `Appraisal Fee` + `Credit Report Fee` + `Processing Fee` + `Processing Fee 2nd TD` + `Origination Fee` + `Application Fee` + `Misc Fee` + `YSP Rebate` - `Deduction Off the Top`) * `LO Split` / 100) as `OfficeProfit`

from ...

or even better

select ...

(`Admin Fee` + `Admin Fee 2nd TD` + `Appraisal Fee` + `Credit Report Fee` + `Processing Fee` + `Processing Fee 2nd TD` + `Origination Fee` + `Application Fee` + `Misc Fee` + `YSP Rebate` - `Deduction Off the Top`)(1-`LO Split` / 100) as `OfficeProfit`

from ...