Friday, March 30, 2012

Mapping table problem

HI guys
I need to put multiple coniditions on my table based on some combinations.

Here is my main table-

Practitioner

DHBName

PHOName

Practicename

PractitionerName

Locum

YCount

NCount

4

Canterbury DHB

Partnership Health (Canterbury)-596721

Linwood Avenue Medical Centre

Christine Abbasi

No

0

1

32

Canterbury DHB

Partnership Health (Canterbury)-596721

Felicia House Clinic (Pearson)

Nicci Pavey

No

0

1

197

Canterbury DHB

Partnership Health (Canterbury)-596721

Woodham Road Health Care

Peggy Shelton-Agar

No

0

1

394

Hawkes Bay DHB

Hawkes Bay PHO Limited-587862

The Doctors Napier

John Laird

YES

1

0

549

Canterbury DHB

Partnership Health (Canterbury)-596721

Linwood Avenue Medical Centre

Denise Armstrong

No

0

1

1286

Canterbury DHB

Partnership Health (Canterbury)-596721

Darfield Medical Centre Limited

Katherine Muscroft-Taylor

No

0

1

1501

Counties-Manukau DHB

Procare Network Manukau Limited-573183

Manukau City Health Centre

Caroline Shephard

YES

1

0

1932

Hawkes Bay DHB

Hawkes Bay PHO Limited-587862

Clive Medical Centre Ltd

Karen Irwin

YES

1

0

2226

Canterbury DHB

Partnership Health (Canterbury)-596721

Sumner Health Centre

Anne Scott

No

0

1

3243

Waitemata DHB

Harbour PHO Ltd-610733

Byron Medical

Rex Livingstone Sinclair

No

0

1

3263

Canterbury DHB

Partnership Health (Canterbury)-596721

Sumner Health Centre

Peter Wynn Nicholson

No

0

1

3381

Otago DHB

Otago Southern Region Primary Health Organisation-597004

Dr Visagie's Practice

Fay Young

NO

0

1

Here is my mapping table-

Locum Flag

No count

Yes count

Percentage

No

1

0

1

No

1

1

0.75

Yes

1

1

0.25

No

2

0

0.5

No

3

0

0.3333

No

4

0

0.25

Yes

2

1

0.125

No

2

1

0.75

Yes

0

1

0.75

Yes

0

2

0.375

Yes

0

3

0.25

Yes

0

4

0.1875

I have to add an additional column called 'percentage' in my main table by refering the mapping table.

For ex for a particular practitioner, Locum flag is 'Yes', nocount is 1 and yes count is 1, then percentage should be '0.25'

How should I do this?

So, when you are adding data to your main table, why not just add a chunk of code that would calculate what the percentage would be and keep the mapping table 'on paper' ? (And then store the result)|||

hi Tas_CRO

How do I add that chunk of code to my main table?

That is probably I need to know

Thanks

No comments:

Post a Comment