how to calculate percentage of total in sql?
SQL Percent To Total The subquery SELECT SUM(Sales) FROM Total_Sales calculates the sum. We can then divide the individual values by this sum to obtain the percent to total for each row.