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.
Author |
Topic |
Tijesuni
Starting Member
4 Posts |
Posted - 2013-03-16 : 09:16:02
|
I have these tablesMANAGEMENT.PAYMENTSPaymentIDPatientIDAdvancePaymentFinalPaymentPaymentStatusFACILITIES.WARDDETAILSWardIDWardNameWard_ChargePATIENTS.PATIENTDETAILSPatientIDDischarge_DateAdmit_DateWard_IDPls how do i validate1)FinalPayment should store the final amount chargeable and must be calculated asTotal Bill - AdvancePayment3)The total bill will be calculated at time of discharge by adding the ward charges for the number of days the patient was admitted to the ward |
|
stepson
Aged Yak Warrior
545 Posts |
Posted - 2013-03-16 : 12:07:13
|
HelloI guess about ManagementPayment, is one per patient per session.not tested select patientID, datediff(d,discharge_Date,Admit_date) * Ward_Charge as [Total Bill], datediff(d,discharge_Date,Admit_date) * Ward_Charge-coalesce(AdvancePayment,0) as FinalPaymentfrom Patients.PatientDetails as PD inner join Facilities.WardDetails as WD on PD.Ward_ID=WD.Ward_ID inner join Management.Payments MP on PD.PatientID=MP.PatientIDCe-am pe mine am si-n dulap, cand ma-mbrac zici ca ma mutsabinWeb |
|
|
stepson
Aged Yak Warrior
545 Posts |
Posted - 2013-03-16 : 12:09:38
|
it will be nice , if where some samples date, for better understand the relation between tables , especially ManagementPaymentSCe-am pe mine am si-n dulap, cand ma-mbrac zici ca ma mutsabinWeb |
|
|
|
|
|
|
|