All pastes #3340 Raw Edit

Connor

public text v1 · immutable
#3340 ·published 2004-12-23 16:11 UTC
rendered paste body
SELECT  calldate,src,substring(dst from '1#\"%#\"' for '#') as dst,
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,accountcode,(select rate from rates where lata = accountcode) as RATE,
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 '$src%')
and accountcode IN ('INTRA','INTER','ONNET')
and lastdata <> ''
and billsec > 0 and billsec < 43200
order by calldate