467,910 Members | 1,774 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,910 developers. It's quick & easy.

Ration calculation

Hi All

Using the query below, I need to get a ratio of paper to electronic claims. Pls help?

elect 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
Sep 3 '08 #1
  • viewed: 974
Share:
1 Reply
Nepomuk
Expert 2GB
Hi Jahannes! Welcome to bytes.com!

It's great to have you here!

When you post, please always keep to the Posting Guidelines and when you post code, please post it in [code] ... [/code] tags.

Now, I found that you had double posted this question (the other one being in the Cafe, where it certainly doesn't belong), which is against the Do Not Double Post Your Questions rule. I have deleted the other post, as this is where your question belongs. Please don't do that again.

Otherwise, I'll just wish you the best and hope you enjoy being part of bytes.com!

Greetings,
Nepomuk
Sep 3 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by cdelaney | last post: by
reply views Thread by gavo | last post: by
4 posts views Thread by Michiel Alsters | last post: by
4 posts views Thread by vg-mail | last post: by
5 posts views Thread by The alMIGHTY N | last post: by
5 posts views Thread by =?Utf-8?B?amVsbGU3OQ==?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.