I have a table with 5 fields:
- id
- name
- charge
- salary
- data
... and I wanted to make a query that would return the names of the people with the highest salary, of each position, for example I have 3 positions: analyst, dev and engineer.
With this script I can bring the highest salary, for example, from the ANALYST position, but how do I bring the other two, and does not this table have a relationship?
SELECT nome, cargo, salario from vendedor
where salario = (SELECT max(salario) from vendedor)