[asterisk-users] Mysql 6 second rounding

Vicky vicky.r at gmail.com
Mon Nov 13 13:52:51 MST 2006


Hey thanx for that Marnus . Thats working  just exactly how i wanted
:) . Damon i actually came up with same row/60+0.5 then roundup trick
when i was doing something same in excel sheets :) and its useful
for billing in 1 minute roundup ( 60 sec pulse ) but i failed to get
it working for 6 second pulse  .
Marnus's sql query is perfect .. now suppose charge is 1.5
 cent /min then i can used 6 second round up'd value and multiple by
0.15  to get call bill in cent and
it can also be used for 30 second pulse or any other
value with small modification .. Thx .

On 14/11/06, Marnus van Niekerk <m at mjvn.net> wrote:
>
> Supposing you have an extra column called 6second:
>
> UPDATE cdr SET 6second=billsec+(6-mod(billsec,6) where 6second=0
>
> if you want a decimal minutes column called billmin
>
> UPDATE cdr SET billmin=round((billsec/60)+0.5),1) where billmin=0
>
>
> Vicky wrote:
>
> Thx and what would the sql query be
> ? . I plan to put additional field as 6second .
>
> How can i make billsec of values of whole table get rounded and filled in field "6second"
> Sorry i am a noob with mysql :D
>
> On 14/11/06, James Coberly <james.coberly at xmc.com> wrote:
> >
> > sum(duration+(6-mod(duration,6) for summary of seconds divisible by 6,
> > /60 for minutes
> >
>
>
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20061113/0213b2a5/attachment.htm


More information about the asterisk-users mailing list