spas2k
spas2k

Reputation: 519

MYSQL Timestampdiff output formatting last two decimals

Simple question

What is the best way to change the output so that it only displays the last two decimals?

SELECT AVG(TIMESTAMPDIFF(hour, start_it,start_qa)

So that the output of '13.2500' displays as '13.25'.

Thanks for your help.

Upvotes: 0

Views: 1009

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269513

Normally, you would do this in the application layer. If you insist on doing it in the database, you can use format():

SELECT FORMAT(AVG(TIMESTAMPDIFF(hour, start_it,start_qa), 2)

Upvotes: 2

Related Questions