Mysql Join to show all records with or without matching records -
I have two tables for employees and another for ratings. Some employees have not been rated to others I am trying to write to all employees without a rating rating or without and trying to sort them with the highest ratings. Expected Output: by that I do not expect the result of the question, it only gives me a line. Thanks in advance Group needs and unify 0 to zero values Do it. Emp.empid = Ratings on Emp LEFT JOINING Ratings as AMPID, Empanen, Collasses (Round (Aviv (ratingview), 2), 0) As the avigating, calls (counting), 0) rating rating. 'DASC' / by the MPID Group APDPID, by order of MPN
emp table empid empName ------ -------- 1 John 2 Alex 3 Peter 4 Mary Ratings Table Rating | Customer | Rating value | Empid --------------------------------------------- 1 1 4 1 2 6 2 1 3 4 3 3 4 5 5 4
empid | EmpName | Avgrating | | RatingsCount --------------------------------------------- 1 John 3 2 2 Alex 3 3 3 3 4 5 5 5 5 1 I tried
SELECT *, round (avg (ratingview), 2) As avgrating, empid empid emph LEFT less emp.empid = ratings as the number of ratings. For rating on MPID ratings, `avgrating` DESC
Comments
Post a Comment