Home > other >  MySQL #1140 - I want to display the minimum salary, it gives this error
MySQL #1140 - I want to display the minimum salary, it gives this error

Time:11-26

I want to display the minimum salary, it gives this error I have to take out one person who gets the lowest salary not using group by

SELECT
    MIN(salary) as 'min_salary',
    name_surname
FROM
    player,
    contracts
WHERE
    player.id = contracts.id
LIMIT 0, 50

MySql error:

#1140 - In aggregated query without GROUP BY, expression #2 of SELECT list contains nonaggregated column 'football_club.player.name_surname'; this is incompatible with sql_mode=only_full_group_by

CodePudding user response:

I'm editing the answer as now the question is more clear.

You can extract the persons with the lowest salaries with:

SELECT
    salary,
    name_surname
FROM
    player
WHERE salary = (SELECT MIN(salary) FROM player)

Of course you'll have more than one row if more player has the lowest salary

  • Related