Happy Business Starts Here

New Student

What order does ZOQL query work

I would like to know what is the order of a ZOQL query result?

 

For example:

 

SELECT Id FROM Account WHERE Name='".$username."'"

 

Is the list going to be in created order if there are multiple records with the same name?

2 REPLIES 2
Highlighted
Zuora Alumni

Re: What order does ZOQL query work

Hi @vbastosREI,

 

There is no order on the query result. However, you can use 'order by' clause in your query to sort results.

 

Thanks.

Dennis



If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √

Master

Re: What order does ZOQL query work

Really?

 

The documentation says "ZOQL does not support sorting results in ascending or descending order."

 

Also, I tried this query (via rest):

 

 

select id, name from rateplan order by name;

 

and the result is:

 

Error: q AssertionError('POST to /action/query
failed:
b\'{"faultcode":"fns:MALFORMED_QUERY","faultstring
":"You have an error in your ZOQL
syntax","detail":{"MalformedQueryFault":{"FaultCod
e":"MALFORMED_QUERY","FaultMessage":"You have an
error in your ZOQL syntax"}}}\'',)