Page 1 of 1

strange SQL result in QMF and batch

PostPosted: Thu Jun 24, 2010 5:58 pm
by syykwok
SELECT X.CNTRY
, (BLA.AMC/12)*C.QXICXXX AS MMMC
, BLA.AMC*C.QXICXXX AS AMC
, (BLA.AMC/12)*C.QXICXXX AS TMC
FROM WCHTXIX X
, WCHTBLA BLA
, WCHTCLC C

When running the above SQL in QMF, the value return for MMMC, AMC, TMC are correct, as in above calculation, AMC is 12 times of MMMC and TMC

However when running the above SQL using batch, the value return for MMMC, AMC, TMC are not correct, AMC is 1.2 times of MMMC and TMC

Anyone got any idea? do I have to put DEC, FLOAT, DOUBLE, etc when dividing, e.g. DEC(BLA.AMC/12)?

Re: strange SQL result in QMF and batch

PostPosted: Thu Jun 24, 2010 11:30 pm
by dick scherrer
Hello,

I'm not positive, but i suspect the results of the query posted would be unpredictable. . .

Re: strange SQL result in QMF and batch

PostPosted: Wed Jun 30, 2010 1:50 pm
by GuyC
I hope you have a join condition somewhere ?
or do tables WCHTXIX and WCHTCLC have only 1 row ?

Re: strange SQL result in QMF and batch

PostPosted: Tue Jul 06, 2010 9:28 pm
by Lindovaldo
I had similar situation.
In my case, the problem was date format. I need put EUR(column_name)/2, for sample.
It was a problem on configuration parameters on default column type.