DROP FUNCTION IF EXISTS secs_to_hrs;
DELIMITER |
create function secs_to_hrs (secs varchar(10))
returns varchar(13)
DETERMINISTIC
BEGIN
return  CONCAT_WS(' h ',lpad(secs/60 div 60,3,' ') , 
CONCAT(lpad(round(secs/60 mod 60),2,' '),' mins') );
END;
|
DELIMITER ;


What if I wanted to not display mins if they're 0?
In oracle I could possibly stick a decode in there.
I can probably break up the function into a few lines and make it work, 
but curious if others had a one-liner addition that I could do.


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to