Perform the following SELECT
:
SELECT funcionario.CODFUNC,
funcionario.NOME,
funcionario.SALARIO,
funcionario.SALARIO * 0.1 * (SELECT COUNT(*) FROM atendimento WHERE atendimento.CODFUNC = funcionario.CODFUNC) COMISSAO,
funcionario.SALARIO + (funcionario.SALARIO * 0.1 * (SELECT COUNT(*) FROM atendimento WHERE atendimento.CODFUNC = funcionario.CODFUNC)) SALARIO_TOTAL
FROM funcionario
Where the values of funcionario
together with the comissao
(given according to the number of calls made by each employee) and the salário total
resulting from the sum of the salary and the commission of each official.
If you want to perform the query for a specific employee, simply add the clause WHERE
with your code at the end of the above query, example below:
WHERE funcionario.cod = 1
At each attending you want to increase 10% of the employee’s salary?
– RXSD
Please [Dit] the post making the rules clearer, preferably with an example of what should happen, especially about the 10% rule, as already asked by colleague @Andre, to avoid that answers are based on misinterpretation. In addition, it would be good to explain the logic of your attempt, so that it is easier to detail the specific part that is difficult to solve.
– Bacco