In my Postgresql database, the
Pupil desk has
I wish to get the share primarily based on scholar marks.
student_marks * 100 / total_marks => 118 * 100 / 147 = 80.27 = 80%
If the primary two digits of decimal quantity are beneath 50, ex: 75.49 then it ought to be 75% or if the primary two digits of decimal quantity are equal to 50 or above 50, ex: 67.50 or 67.52 then it ought to be 68% so
This question works for me:
choose TO_CHAR(19.57, 'fm99%') as abc;
it returns 20%.
The issue is of the coed get 100% marks:
choose TO_CHAR(100, 'fm99%') as abc;
Please present me an answer for this or else recommend one other manner to do that.