Use SUM() function in a multiple tables relationship


I am a new learner of SQL, I am using MYSQL server, and POPSQL as an editor. Just doing some exercises, I created three tables titled respectively with 'client', 'employee', and 'sale', and I have been trying to get some SQL queries out from the data restored in the tables: the problem query is that: I am trying to get

who is the most successful employee who achieved a yearly sale amount more than 500000 USD,

As the pictures attached within this post, there must be sth wrong as to write the proper WHERE condition, sounds difficult to figure out, can you help pls?

< means less than
> mean more than

you have less than 500000

1 Like