we have 2 table, table A and table B,
we are fetch 6 columns in select statement, these are the columns
- A.current_value,
- A.original_value,
- A.current_tax_lot,
- B.current_tax,
- B.cost_tax,
- B.current_tax_cost
now we have to put mathematics condition in query:
A.current_value – B.current_tax is within +/- 2, and
If A.original_value is blank use A.current_tax_lot to perform the formula:
2a. A.current_tax_lot (from above) – B.cost_tax is within +/- 10, or
2b. A.current_tax_lot(from above) – current_tax_cost is within +/-10)