Problem with union casting integer to ceiling(decimal)
10
votes
2
answers
2221
views
I have this scenario, it looks like MySQL is taking the largest decimal value and tries to cast the other values to that.
The problem is that this query is generated by an external library, so I don't have control over this code, at this level at least.
Do you have some idea how to fix this?
SELECT 20 AS x
UNION SELECT null
UNION SELECT 2.2;
+------+
| x |
+------+
| 9.9 | -- why from 20 to 9.9
| NULL |
| 2.2 |
+------+
Expected Result
+------+
| x |
+------+
| 20 | -- or 20.0, doesn't matter really in my case
| NULL |
| 2.2 |
+------+
Adding more context, I'm using Entity Framework 6 with an extension library http://entityframework-extensions.net/ to save changes in batches, specifically the method context.BulkSaveChanges();, this library creates queries using "select union".
Asked by ngcbassman
(103 rep)
Apr 24, 2018, 05:06 AM
Last activity: May 16, 2018, 03:43 PM
Last activity: May 16, 2018, 03:43 PM