By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,575 Members | 1,948 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,575 IT Pros & Developers. It's quick & easy.

Ration calculation

P: 1
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',
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,
Sep 3 '08 #1
Share this Question
Share on Google+
1 Reply

Expert 2.5K+
P: 3,112
Hi Jahannes! Welcome to!

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!

Sep 3 '08 #2

Post your reply

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