To join three table and make some arithmics on the columns you should use a join, which is covered here https://tray2.se/posts/database-design-part-2
To make the calculations you just do standard math + - * / depending on what you need to calculate. If you want to do math with more than one row you need to use aggregate functions and group bys, how to do that can be found here https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html