I'm creating a web reporting app using PHP and connect to our VFP9 database with MS OLE DB Provider for VFP9.
I was previously using ODBC but it couldn't do embedded select statements so switched to OLE DB which has more functionality but I'm getting problems with the exact same query that worked fine in ODBC.
Its a very long SQL statement so I won't post it all the bit that is the problem is a simple sum that returns a 0 instead of the correct figure:
sum((quantityreq - quantityinv) * (unitval / 100)) as value //returns 0 expected 9907.2
quantityreq = 344
quantityinv = 0
unitval = 2880
The following does work :
sum((quantityreq - quantityinv) * unitval) as value //returns 990720 I just can't divide this by 100 at any part in the sum it returns a 0
sum((quantityreq - quantityinv) * (2880 / 100)) as value // returns 9907.2 as intended if I actually type the number in
I wondered if was to do with data types and changed integers to doubles using CAST but same result, any help appreciated as my head is getting very sore.
I was previously using ODBC but it couldn't do embedded select statements so switched to OLE DB which has more functionality but I'm getting problems with the exact same query that worked fine in ODBC.
Its a very long SQL statement so I won't post it all the bit that is the problem is a simple sum that returns a 0 instead of the correct figure:
sum((quantityreq - quantityinv) * (unitval / 100)) as value //returns 0 expected 9907.2
quantityreq = 344
quantityinv = 0
unitval = 2880
The following does work :
sum((quantityreq - quantityinv) * unitval) as value //returns 990720 I just can't divide this by 100 at any part in the sum it returns a 0
sum((quantityreq - quantityinv) * (2880 / 100)) as value // returns 9907.2 as intended if I actually type the number in
I wondered if was to do with data types and changed integers to doubles using CAST but same result, any help appreciated as my head is getting very sore.