[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql
Subject:    Re: convert duration(mediumint) to hours and minutes
From:       "Michael Dykman" <mdykman () gmail ! com>
Date:       2007-03-29 19:19:48
Message-ID: 814b9a820703291219u3bb6e2afw5dd15fd648dd6bd7 () mail ! gmail ! com
[Download RAW message or body]

this will format that value inline.
select concat(floor(pr_id / 60),':',mod(pr_id,60)) AS mytime  from ...

If you are running 5.0+ you may want to push this down into a UDF

 - michael

On 3/29/07, Reinhart Viane <rv@domos.be> wrote:
> Hello list,
>
> I have a table events in a database that has a field named duration. This
> field is a mediumint containing an amount of minutes (eg 65, 87, 10368)
> Now I need these to be outputted into a h:mm (so 65 will be represented as
> 1:05)
>
> My complete query is:
> select YEAR(events.workdate) as theyear,
> (sum(events.duration)/60),clients.name, persons.name from events, persons,
> clients where events.personid= persons.personid and events.clientid=
> clients.clientid group by clients.name, events.personid, theyear;
>
> this does, off course not give me the wanted result.
> How can I convert these numerical entries to hh:mm in my query?
>
> (days do not matter, I just need hours and minutes, thx)
>
> Regards and thanks,
>
> Reinhart Viane
> D-studio
> Graaf van Egmontstraat 15/3
> 2800 Mechelen
> rv@domos.be- +32(0)15 44 89 01
>
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?unsub=mdykman@gmail.com
>
>


-- 
 - michael dykman
 - mdykman@gmail.com

 - All models are wrong.  Some models are useful.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=mysql-marcsub@progressive-comp.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic