> CASE WHEN (s.bDrAmt > 0 AND uf.bCr > 0) THEN s.bDrAmt - uf.bCr > WHEN (s.bDrAmt > 0 AND uf.bDr > 0) THEN s.bDrAmt - uf.bDr > WHEN (uf.bDr IS NULL AND uf.bCr IS NULL) THEN s.bDrAmt > ELSE 0 END AS bBalDr,MyStoredProcCr
> CASE WHEN (s.bCrAmt > 0 AND uf.bDr > 0) THEN s.bCrAmt - uf.bDr > WHEN (s.bCrAmt > 0 AND uf.bCr > 0) THEN s.bCrAmt - uf.bCr > WHEN (uf.bDr IS NULL AND uf.bCr IS NULL) THEN s.bCrAmt > ELSE 0 END AS bBalCrThis is just one table now. As soon as I add more tables they will be also be queried and having similar query results, irrespective of the fields the future table contains, the logic and cursor fields will remain the same as for this AccountsJV tables