Issue #2007070 by sgorobet: Use COALESCE instead of IFNULL, and avoid using the field alias to support MS SQL Server.