Skip to content Skip to sidebar Skip to footer

Unique Results For SQL Command With GROUP, MIN And NULL Values

I have a table inquiry with columns job, gender (TRUE for women, FALSE for men) and salary. None of the columns is unique, salary may contain NULL. How to find the minimum salary p

Solution 1:

Aggregate functions ignore nulls. Lose the join and you should be OK:

SELECT   job, MIN(salary)
FROM     inquiry
WHERE    gender = 1
GROUP BY job

Post a Comment for "Unique Results For SQL Command With GROUP, MIN And NULL Values"