azure-cosmos-db-emulator-docker
azure-cosmos-db-emulator-docker copied to clipboard
ORDER BY with a function (and GROUP BY too)
When using ORDER-BY with a function:
SELECT p.name FROM products p ORDER BY LENGTH(p.name) DESC
The query would fail, and there's the same issue with GROUP-BY.
Luckily, for ORDER-BY, there's a quick workaround:
SELECT p.name, LENGTH(p.name) AS p.namelen FROM products p ORDER BY p.namelen DESC
This is a known issue from our query backend and we already let that team know. If you find more tricks on its workaround, feel free to comment below.