Skip to content

Commit 57c9044

Browse files
committed
update distinct keyword restrictions
1 parent 0e4b1ff commit 57c9044

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

articles/cosmos-db/nosql/query/keywords.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ You can also project unique objects. In this case, the lastName field does not e
5959
SELECT DISTINCT f.lastName
6060
FROM Families f
6161
```
62-
62+
soapy
6363
The results are:
6464

6565
```json
@@ -113,14 +113,15 @@ SELECT COUNT(1) FROM (SELECT DISTINCT f.lastName FROM f)
113113
|Node.js SDK|Unsupported|
114114
|Python SDK|Unsupported|
115115

116-
There are some additional restrictions on queries with an aggregate system function and a subquery with `DISTINCT`. The below queries are unsupported:
116+
There are some additional restrictions on queries with a subquery with `DISTINCT`. The below queries are unsupported:
117117

118118
|**Restriction**|**Example**|
119119
|-------|----------------------|
120+
|Subquery|SELECT VALUE f FROM (SELECT DISTINCT c.year FROM c) f|
120121
|WHERE clause in the outer query|SELECT COUNT(1) FROM (SELECT DISTINCT VALUE c.lastName FROM c) AS lastName WHERE lastName = "Smith"|
121122
|ORDER BY clause in the outer query|SELECT VALUE COUNT(1) FROM (SELECT DISTINCT VALUE c.lastName FROM c) AS lastName ORDER BY lastName|
122123
|GROUP BY clause in the outer query|SELECT COUNT(1) as annualCount, d.year FROM (SELECT DISTINCT c.year, c.id FROM c) AS d GROUP BY d.year|
123-
|Nested subquery|SELECT COUNT(1) FROM (SELECT y FROM (SELECT VALUE StringToNumber(SUBSTRING(d.date, 0, 4 FROM (SELECT DISTINCT c.date FROM c) d) AS y WHERE y > 2012)|
124+
|Nested subquery with aggregate system function|SELECT COUNT(1) FROM (SELECT y FROM (SELECT VALUE StringToNumber(SUBSTRING(d.date, 0, 4 FROM (SELECT DISTINCT c.date FROM c) d) AS y WHERE y > 2012)|
124125
|Multiple aggregations|SELECT COUNT(1) as AnnualCount, SUM(d.sales) as TotalSales FROM (SELECT DISTINCT c.year, c.sales, c.id FROM c) AS d|
125126
|COUNT() must have 1 as a parameter|SELECT COUNT(lastName) FROM (SELECT DISTINCT VALUE c.lastName FROM c) AS lastName|
126127

0 commit comments

Comments
 (0)