Select * from Namelist;
Name Age
Sathish 25
Sathish 65
Sathish 55
Sathish 45
Sathish 35
Jana 55
Jana 25
Jana 10
Bala 55
Bala 26
How to get Percentage value for given format;
Name Count Percentege
Sathish 5 50%
Jana 3 30%
Bala 2 20%
Kindly share sql query?
This is a slightly sexier version of some of the other answers - note the use of
sum(100)
to avoid the longer (and more mundane)count(*) * 100
:)This query(not tested) should work :
replace column name and try this:
Output: