-
Website
http://awads.net/wp/ -
Original page
http://awads.net/wp/2006/06/14/cool-sql-analytic-function-ratio_to_report/ -
Subscribe
All Comments -
Community
-
Top Commenters
-
jgarry
3 comments · 1 points
-
Andy C
22 comments · 47 points
-
dahowlett
1 comment · 2 points
-
Don Seiler
9 comments · 1 points
-
davidhaimes
4 comments · 3 points
-
-
Popular Threads
Hi Eddie;
used it today the first time!
Karl
select practice_fk as 'Prac_No1',
p.doc_short_descr as 'Prac_Name1',
DS.dsp_ind,
accreditation,
accred_level,
SUM(isnull(convert(numeric,(1)),0)) as 'Total_Claims',
SUM(CASE WHEN convert(numeric,trade_fk) 0 THEN 1 ELSE 0 END) as 'EDI',
SUM(CASE WHEN convert(numeric,trade_fk) = 0 THEN 1 ELSE 0 END) as 'Paper'
from ( select c.claim_fk,c.trade_fk,c.practice_fk,c.rcvd_date
from tf_claim C with (nolock)
where benefit_amt >= 0.05
AND practice_type IN (14,15,50,51)
AND convert(datetime,convert(varchar,claim_dt),112) BETWEEN '1 MAY 2008' AND '31 AUG 2008'
group by c.claim_fk,c.trade_fk,c.practice_fk,c.rcvd_date
) CLAIM LEFT JOIN td_practice P with (nolock) ON (practice_pk = practice_fk)
LEFT JOIN pcdw2.dw_staging.dbo.tsd_dsp ds ON (ds.practice_pk = claim.practice_fk)
LEFT JOIN dbo.td_negotiation2 n on (n.negotiation_pk = ds.neg_num)
Where DS.dsp_ind = 'DSP'
group by practice_fk,
p.doc_short_descr,ds.dsp_ind,accreditation,
accred_level
I googling for ratio_to_report and came across your post. I noticed it links to an old blog post of mine. orablogs.com kicked the bucket a long time ago. FWIW, I revived this post on my new blog:
http://blogs.oracle.com/sergio/2008/10/quick_an...
Sergio