> For the complete documentation index, see [llms.txt](https://couchbase.shujuwajue.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://couchbase.shujuwajue.com/n1ql-ji-chu-cao-zuo-jiao-cheng/n1qlji-chu/10select-distinct.md).

# 10.Select DISTINCT

可以使用DISTINCT关键字来消除重复文档的输出。

Query：

```sql
SELECT DISTINCT orderlines[0].productId
    FROM orders
```

结果

```javascript
{
  "results": [
    {
      "productId": "coffee01"
    },
    {
      "productId": "tea111"
    }
  ]
}
```

对比查询

```sql
SELECT  orderlines[0].productId
    FROM orders
```

结果：

```javascript
{
  "results": [
    {
      "productId": "coffee01"
    },
    {
      "productId": "coffee01"
    },
    {
      "productId": "tea111"
    },
    {
      "productId": "coffee01"
    }
  ]
}
```
