Azure cosmos db别名列顺序依据

Azure cosmos db别名列顺序依据,azure,azure-cosmosdb,Azure,Azure Cosmosdb,我已经在COSMOSDB中编写了一个select查询,效果很好。但在该查询中,当我尝试在alias列上添加order by列时,它不起作用。这里距离是一个别名列,正确的方法是什么 SELECT c.id,c.type,c.name,c.latitude,c.longitude,c.location, ST_Distance(c.location, { 'type': 'Point', 'coordinates':[-112.215641, 33.181647]}) as distance FRO

我已经在COSMOSDB中编写了一个select查询,效果很好。但在该查询中,当我尝试在alias列上添加order by列时,它不起作用。这里距离是一个别名列,正确的方法是什么

SELECT c.id,c.type,c.name,c.latitude,c.longitude,c.location, ST_Distance(c.location, { 'type': 'Point', 'coordinates':[-112.215641, 33.181647]}) as distance FROM c WHERE ST_Distance(c.location, { 'type': 'Point', 'coordinates':[-112.215641, 33.181647]}) < 321868.8 ORDER BY c.distance ASC
选择c.id、c.type、c.name、c.lation、c.longitude、c.location、ST_Distance(c.location,{type':'Point'、'coordinates':[-112.215641,33.181647]})作为到c的距离,其中ST_Distance(c.location,{'type':'Point',coordinates':[-112.215641,33.181647]})按c.Distance ASC排序<321868.8

实际上,我们被告知只能使用文档的属性进行排序,而不能使用派生值。请查看此项。您的
距离
列是派生值,不能在
订单中使用

“不支持ORDER BY子句。无法使用ORDER BY item表达式。” 映射到文档路径“


我建议您自己对查询结果进行排序。例如,在.net代码中,您可以使用函数按列对结果进行排序。

您好,我的答案对您有帮助吗?是的。。我看到没有人支持。。