# php sql percentage of rows

Hello i have problem, i want to my php script calculate percent of ex.

row 1 have 'dmg' value '62'

row 2 have 'dmg' value '38'

now, script need sto calculate this etc:

row 1 is:

62% of total 'dmg'

and row 2 is:

38%

the percent need to be max. 100% ex. 'dmg' of row 1 can be 6200 and 'dmg' of row 2 can be 3800 but percent need to be 100% max...

any help? i tryed scripts but no one helps .. thanks!! try.