I saw a post here in stack overflow with question and answer very similar to my problem. its this post: MySQL: turn decimal into percent within view
and as said in the post above, use:
CONCAT(columnname * 100, '%')
and thats what i actually did.. i have a table with a column for percentages for specific ranges of salary. its a salary deduction schedule. i stored the percent values as a decimal datatype in column "ee".
ee | decimal(4,4) | not null
and my problem is its giving me this result and its not what i wanted.. for example, an entry in the column is 0.0200
, and i want to show it upon viewing as "2%
", but this is what i get.
select s_b,rangeA,rangeB,concat(ee * 100,'%') as 'ee_percent' from htbl;
+___________________________________+
|s_b| rangeA| rangeB|ee_percent |
+---+--------+---------+------------+
| 1| 0.00| 1500.00| 1.0000% |
| 2| 1500.00|999999.99| 2.0000% |
+-----------------------------------+
I know that this is a duplicate and an elementary question, but i don't know why its not working, if you see a mistake somewhere in my syntax, or in the data type please tell me. any suggestions and corrections are highly appreciated. Thank you so much.