Friday, February 24, 2012

Complex calculation!!

Hi
I have got two tables and have one to many relationship on them.
i ll show you the sample data


Table 1
ID DoctorName Practice Full_Time Cost Expenditure
1 ABC qw yes $100
2 ABD wer no $566
3 ZXA ddf yes $22
........................

table 2
Practices
qw
wer
ffgg
hhjk
ddf
..
The scenario is like this
a doctor can work in more than one practice. and he can be a full time practioner or a part time practitioner

The problem is if a doctor is a full time practioner in 1 service and a part time practitioner in another, 75% of cost goes to first practice and the rest 25% goes to other

if the doctor is non full time in more than one practice, the cost gets distributed equally in all practices.

how shall i do this?
pls HELP!!

Moving to the T-SQL forum.

No comments:

Post a Comment