I found this question ( How to get the max of two values in MySQL? ) while looking for ways to compare discrete set of values.
I want to be able to get the minimum of few selected values where some of them may be null because they are optional but the MySQL docs says:
If any argument is NULL, the result is NULL.
Use a
COALESCE()function on the nullable values:if you get the max int value, then both were null (unless there’s a decent chance you could actually have the max int value as a real argument, then more logic is necessary)