Hello,
I have written a query but I am not sure if it is efficient.
There are two tables, USERS and SCORE. USERS can be of three types, administrators, supervisors, trainers. Each trainer is assigned to a supervisor, which is stored in the users table.
Now the issue is: A supervisor can view his scores and the scores for trainers assigned to him.
The query I have written is :
Is there a better way of achieving the result?Code:SELECT s.* FROM score as s, users as u WHERE s.trainerid=u.userid AND u.supervisor=50
UNION
SELECT * FROM score WHERE trainerid=50;
I am using MySQL 5.0.
Thank you.
