mardi 12 janvier 2016

MySQL function to select float value as integer if its decimal point is 0

I'm having a column of float type(amount). The value can be an integer or float . I want to get the value as integer if the decimal point is 0(eg: value = 0.0, 1.0 etc) and need the value as decimal itself if it has got decimal points. Is there any MySQL function for this? The following is my query

SELECT GROUP_CONCAT(CONCAT(reason_code, ':', COALESCE(identifier, ''), '', amount * -1)) AS accout_groups FROM adjustments WHERE check_id = 1 GROUP BY department_id*

Result of query is below

PI:-900.00,AP:-87.00,CS:12312312*-1500.00,SL:12312312*-1103.83

What Iam expecting is

PI:-900,AP:-87,CS:12312312*-1500,SL:12312312*-1103.83

Aucun commentaire:

Enregistrer un commentaire