I want to remove digit after decimal how to solve it?
My query is:
SELECT city_name,
Assignedto,
COUNT(Assignedto) AS TC,
CONCAT(count(CASE
WHEN STATUS = 'CLOSED' THEN 1
ELSE NULL
END) * 100 / count(1), '%') AS SC,
CONCAT(count(CASE
WHEN STATUS = 'PENDING' THEN 1
ELSE NULL
END) * 100 / count(1), '%') AS PC,
SUM(TIMESTAMPDIFF(MINUTE,Request_Date, Xetr))/60 AS WH,
(154440-sum(TIMESTAMPDIFF(MINUTE,Request_Date, Xetr))/60) AS VH,
CONCAT(COUNT(Feedback_Rate)/COUNT(Assignedto)*100,'%') AS Feed_Percent,
SUM(Feedback_Rate)/(count(Feedback_Rate)*5)*5 AS AVG_Feedback
FROM `it_service_ticket`
INNER JOIN `it_problem`ON `it_service_ticket`.`it_problem_id`=`it_problem`.`it_problem_id`
INNER JOIN `city_master` ON `it_service_ticket`.cityid=`city_master`.city_id
WHERE `it_service_ticket`.`xetr` BETWEEN '2016-04-01 12:00:00 AM' AND '2017-02-28 12:00:00 PM'
GROUP BY Assignedto
ORDER BY city_name ASC;
Output
+-------------------------+-------------------------+-------+------------+----------+------------+--------------+-----------+---------+
| City_Name | AssigneeTo | TC | SC | PC | WH | VH | Feedback | Average |
+-------------------------+-------------------------+-------+------------+----------+------------+--------------+-----------+---------+
| Ahmedabad | [email protected] | 297 | 100.0000% | 0.0000% | 147.0667 | 154292.9333 | 43.4343% | 4.4031 |
| Ahmedabad | [email protected] | 297 | 100.0000% | 0.0000% | 147.0667 | 154292.9333 | 43.4343% | 4.4031 |
If you want to round off decimal places, use ROUND(yourColumn,0)
function.
So 13.78
will become 14
If you want to get rid of decimal places, user FLOOR(yourColumn)
So 13.78
will become 13
So for example
SUM(TIMESTAMPDIFF(MINUTE,Request_Date, Xetr))/60 AS WH
should be changed to
ROUND(SUM(TIMESTAMPDIFF(MINUTE,Request_Date, Xetr))/60,0) AS WH
Edit: This would take care of your %
.
CONCAT(
ROUND(count(CASE
WHEN STATUS = 'PENDING' THEN 1
ELSE NULL
END) * 100 / count(1),0)
, '%') AS PC
Do the same for all the columns you need to remove decimal places.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With