I have a query that resembles what follows below. I get different results from PDO/PHP than I do in the interactive SQL prompt on the server. When running this query through interactive SQL I see transaction amounts correctly (ie. 45.34).
When I pull results through PDO I see incorrect results with falsely added precision (ie. 45.3400000000001). Is there something in PDO that can be set to return this data as is stored in the database?
Select tl.ID
, tl.Transaction_Amount
from transactionLog tl
Update: The data returned from the query is being formatted into json. I have verified the pre-json data to also contain false data. One answer from antoox suggests rounding at the db level in the query. This, unfortunately, does not help as the query returns correct data when run at a SQL prompt, and rounded or not is displayed incorrectly once it has come through PDO. PHP bug #53632 is also mentioned by antoox. Unfortunately this bug is not a factor in our environment as we are on a far more recent version.
Update: The database field is numeric size 10 with scale 2 as reported by Sybase Central.