I have items in my cosmosdb and I want to order them by the orderStatus. RECEIVED item will be listed first, then PROCESSING items and then COMPLETED items.
Here is the query I have written. But unfortunately it does not works.
SELECT * FROM c
WHERE c.orderStatus IN ('RECEIVED', 'PROCESSING', 'COMPLETED')
ORDER BY IIF(c.orderStatus = 'RECEIVED', 1,
IIF(c.orderStatus = 'PROCESSING' , 2, 3))
I checked the documentation to find the way I wrote is a valid SQL for Cosmos DB. Found nothing. Any suggestion or alternative approach to query?