问题 Most databases have something like a GREATEST function, which can be useful some times. At least these databases don't have such a function: Derby SQL Server Sybase ASE Sybase SQL Anywhere For SQL Server and Sybase SQL Anywhere, the function can be simulated using subqueries and UNION ALL , as can be seen in this question here. An example: -- SELECT GREATEST(field1, field2, field3) FROM my_table SELECT (SELECT MAX(c) FROM (SELECT my_table.field1 AS c UNION ALL SELECT my_table.field2 UNION ALL