MySQL Forums
Forum List  »  Newbie

Adding Percentage to SQL Output
Posted by: Ammar Zorba
Date: September 05, 2020 05:59AM

Hi I am using this statement to obtain employees number based on year and gender:

SELECT YEAR(t_dept_emp.FROM_DATE) as Hiring_Year, t_employees.gender as Gender, COUNT(t_employees.emp_no) as No_Of_Employees FROM t_employees JOIN t_dept_emp ON t_dept_emp.emp_no = t_employees.emp_no group by YEAR(t_dept_emp.FROM_DATE), gender having Hiring_Year >= '1990' order by Hiring_Year ;

The result is fine but is it doable by using SQL to enhance the output by adding Male and Female percentage for each record based on year too as following:

Hiring_Year || Gender || No_Of_Employees || Percentage

Thank you in advance

Options: ReplyQuote


Subject
Written By
Posted
Adding Percentage to SQL Output
September 05, 2020 05:59AM
September 25, 2020 05:42AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.