Fields should be escaped by quoteIdentifier for max/min functions which allows SQL reserved keywords to be used. Closes #676