All pastes #3339 Raw Edit

Connor

public text v1 · immutable
#3339 ·published 2004-12-23 16:10 UTC
rendered paste body
SELECT  src,
SUM (CASE billsec % 6
  WHEN 0 THEN ((( (billsec/6) *6)::float(1)/60)::float(1))::float(1)
  ELSE        ((( ((billsec/6 +1)* 6))::float(1)/60)::float(1))::float(1)
END) as minutes,
sum( CASE billsec % 6
      WHEN 0 THEN ((( (billsec/6) *6)::float(1)/60)::float(1) * (select rate from rates where lata = accountcode)  )::float(1)
      ELSE        ((( ((billsec/6 +1)* 6))::float(1)/60)::float(1)* (select rate from rates where lata = accountcode) )::float(1)
    END) as amount
FROM public.cdr
WHERE calldate >= '11/01/2004' and calldate < '12/01/2004'
and (src like '540%')
and accountcode IN ('INTRA','INTER','ONNET')
and lastdata <> ''
and billsec > 0 and billsec < 43200
group by src