Provide support for DISTINCT
Need to provide support for SELECT DISTINCT xyz FROM c.
As noted by some comments below, support for DISTINCT is now available. We are working on updating our documentation for this to provide examples and more information. The updated documentation will be published in our SQL query doc here, https://docs.microsoft.com/en-us/azure/cosmos-db/sql-api-sql-query. Stay tuned, this will be updated soon.
Tài béo commented
Tài đẹp trai
I am trying to use Distinct in my query. The query runs fine in UI but when I try to use @azure/cosmos library to pull data using the same query, I am getting duplicate records.
Any updates on the fix for this issue?
Where is the documentation that talks about Distinct clause
SELECT DISTINCT c.deviceid FROM c is returning all the duplicate values also when tried from a CosmosDB Triggering function.
The documentation hasn't been updated since Oct 2018. Please update the docs.
SELECT DISTINCT c.deviceid FROM c , slow and can't output anything~
We're still encountering problems with SELECT DISTINCT in the data explorer, as mentioned below. Any updates on this?
Apparently this is not supported on multi partition collections?
This feature is broke in the data explorer. Because cosmos can only return 100 results per page at a time, the distinct keyword will only apply to a single page. So, if your result set contains more than 100 results, you may still get duplicates back - they will simply be on separately paged result sets.
Ravi Shankar commented
My DISTINCT query always fails with 429 error while other queries works fine. Not sure how this is implemented.
[Deleted User] commented
So with distinct now working in the SQL-style queries, can we expect support for Linq to SQL distincts soon? Any chance it might sneak into the 2.0 nuget stable release?
Rob Catalano commented
Holy Smokes! - I think it's working. I just ran this a query in the azure portal using this syntax: SELECT distinct value c.vendorId FROM c where c.status = 0 and c.eventCode = null and c.locations <> null and c.postalCode != '15219' and c.postalCode != '81212' for our site https://adventurebot.com and it actually gave me a distinct list.
Yohan S. commented
Any update on this please ?
this seems to work in the sql playground.
returns 26 documents. you can then do a series of second level queries to "group by" of something like:
where food.foodGroup="Soups, Sauces, and Gravies"
Yes please. This is blatantly missing functionality.
Simon Steele commented
Found this post today... it shows that these features are in Preview since end 2017... but you have to enable the preview features in your Azure Cosmos DB by going to the Preview Features tab and enabling it.
Any update on this?
I find it unbelievable this basic feature is still not available! when will it happen?
Tried the MongoDB API to Cosmos since it has nice aggregates, but it won't work for us because it lacks the performance (think MaxDegreeOfParallelism in DocumentDB queries). This aggregate support is sorely needed. Is there an ETA? We are thinking of moving to a different DB at this point.