![]() | |
#1
| ||||
| ||||
|
|
_b1 | _b2 | _b3 | _t1, calc _b1-_t1 as P1Bal | |
|
_t2, calc _b2-_t2 as P2Bal | _t3, calc _b3-_t3 as P3Bal | |
|
CheckPlus | CheckPlus | CheckPlus _tb, as CurrBal | |
|
_tt, calc _tb-_tt as TotBal | |
#2
| |||
| |||
|
|
Howdy all. Have a problem converting a Pdox QBE to SQL in that the results of the Pdox QBE treats nulls as 0s as I have Treat blanks as zeros in the Database tab of Preferences (tools, settings, preferences). However, the sql query does not treat blanks as zeros and thus the balance calculation from the SQL are off from the QBE calc. All table results leading up to this query are a match between the QBE and sql results. How may I include or haves zeros (0) used in the sql query. Or is the sql conversion incorrect? In the sql conversion, initially only CAST the results of the calculation instead of each field in the calculation being CAST. Found that this resulted in incorrect values... Both qbe and sql conversion are below. Using Pdox 10 sp3. Thank you, Rey *************************** qs11 = query ; creates riv:statun0B.db:PRIV:STATUN0A | P1Bal | P2Bal | P3Bal | P1Trans | | _b1 | _b2 | _b3 | _t1, calc _b1-_t1 as P1Bal | :PRIV:STATUN0A | P2Trans | P3Trans | | _t2, calc _b2-_t2 as P2Bal | _t3, calc _b3-_t3 as P3Bal | :PRIV:STATUN0A | UnitNumFK | AssnNumFK | TotBal | | CheckPlus | CheckPlus | CheckPlus _tb, as CurrBal | :PRIV:STATUN0A | TotTran | | _tt, calc _tb-_tt as TotBal | EndQuery *********************************** sqlqs11= SQL SELECT UnitNumFK, AssnNumFK, TotBal CurrBal, (CAST(P1Bal AS NUMERIC) - CAST(P1Trans AS NUMERIC)) P1Bal, (CAST(P2Bal AS NUMERIC) - CAST(P2Trans AS NUMERIC)) P2Bal, (CAST(P3Bal AS NUMERIC) - CAST(P3Trans AS NUMERIC)) P3Bal, (CAST(TotBal AS NUMERIC) - CAST(TotTran AS NUMERIC)) TotBal FROM STATUN0A endSQL |
![]() |
| Thread Tools | |
| Display Modes | |
| |