PropicSignifi/Query.apex

The order by clause is incorrect when there are multiple fields with different directions

HenryRLee opened this issue · 0 comments

To be more specific:

new Query('Account').orderBy('Name', 'DESC').orderBy('Phone', 'ASC').run()

This will create a query with two order by clauses, but both of them are in ascending order, which is incorrect.

The current result of the query will be like:

SELECT Id FROM Account ORDER BY Name, Phone ASC

The expected result should be:

SELECT Id FROM Account ORDER BY Name DESC, Phone ASC

Moreover, the nulls first method should be related to one order by clause, so that each one can have a nulls first control. Right now we only have a global one.