---
source_url: https://docs.dolphindb.cn/zh/error_codes/s02037.html
fetched_at: 2026-05-19T09:09:54Z
category: error_codes
title: S02037
sha1: ac90ff913ddcad40989a2f52c9662c61cd8641e6
---

# S02037

## 错误代码

S02037

## 报错信息

The '[not] in' predicate cannot be followed by columns from the partitioned table.
Please use a subquery instead. RefId:S02037

## 错误原因

DolphinDB 不允许在 in/not in 表达式中将分布式表列用于右侧。以下几个查询都会导致此报错：

```dolphindb
dbName = "dfs://test"
if (existsDatabase(dbName)) {
    dropDatabase(dbName)
}

promotion = table(1..10 as id, 1..10 as relatedId);

db = database(dbName, VALUE, 1..10)
promotionPt = db.createPartitionedTable(promotion, `promotionPt, `id)
promotionPt.append!(promotion)

select * from promotionPt where id in relatedId
select id, id in relatedId as related from promotionPt
select first(id) from promotionPt group by id in relatedId
select * from promotionPt order by id in relatedId

// not in
select * from promotionPt where id not in relatedId

item = table(1..3 as id)
// join
select * from item inner join promotionPt on item.id=promotionPt.id where id in relatedId
```

## 解决办法

检查是否存在 in/not in 表达式中分布式表列出现在右侧的情况。
