select Service_Date = t1.service_date, Charge_Amount_SD_CC = t1.total_charge from Claim_Charge t1 inner join Claim_Header t2 on t2.claim_header_pk = t1.claim_header_fk where t1.service_date = '12/31/2007' and t2.inpatient in (0) and t1.voided = 0 and CASE WHEN t2.non_primary_payer = 0 THEN 1 ELSE 0 END = 1 and t2.replaced = 0 select IB_Charge_BT_PK = t1.ib_item_bt_pk, Service_Date = t1.service_date, Total_Charge = t1.total_charge from IB_Item_BT t1