Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Filter on Specific table

Author  Topic 

werhardt
Constraint Violating Yak Guru

270 Posts

Posted - 2008-07-01 : 11:15:38
I have this query below and I need to just pull specific codes from a certain tabled called cptcodeMedical. What I also need to do is pull any other cpt codes(clms table) that fall under that claimnumber that was pulled by the specific CPTCodes (cptcodeMedical). How would I do that and is that possible to do?

SELECT Distinct

CASE clm_ips
WHEN 'C' THEN clm_pclm
ELSE clm_id1
END as "claimnumber1",
clms_proc as 'CPTCODES',
CLM_6A as "DOSFROM",
CLM_6B as "DOSThru",
clms_desc,
CLMS_UNIT as 'Units',
Cli_name as "CLIENTNAME",
Pro_XTYP,
CLM_1A As 'ProvdierGroupName',
CLM_5 as PROVIDERTAXIDNUMBER,
CLM_12A as "PATIENTLASTNAME",
CLM_12B as "PATIENTFIRSTNAME",
CLM_TCHG as 'Total_Charges', --CLM_MCHG as "TOTALCHARGES",
CLM_NEGO as 'Total_Allowed_Charges', --CLMS_ALLOW as "ALLOWEDCHARGES",
clm_sppo as 'Total_Savings',
CLMS_CHG as 'BilledCharges_Per_Line',
CLMS_Allow as 'AllowedCharges_Per_Line'





FROM dbo.clm
inner join dbo.clms on dbo.clm.clm_id1 = dbo.clms.clms_id
inner join dbo.pro
on dbo.clm.clm_1 = dbo.pro.pro_id1
inner join dbo.mem
on dbo.clm.clm_38 = dbo.mem.mem_id1
inner join dbo.cli
on dbo.clm.clm_clir = dbo.cli.cli_id1
Left join dbo.prop
on dbo.prop.prop_id1 = dbo.clm.clm_id1

inner join dbo.clip clip
ON cli.cli_id1 = clip.clip_id1



Where
clms_proc <> '' and
CLMS_Allow > 0.00

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-01 : 12:33:18
Can you provide some sample data from your tables and explain what you want? That will much easier than looking into query as we dont know how data is and how tables are related.
Go to Top of Page
   

- Advertisement -