Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
254 views
in Technique[技术] by (71.8m points)

对分布式表去重报错

我在DolphinDB database中有一张分布式表tb_kline,其字段和数据如下图所示:
image.png

现在我要把tb_kline中DT,Code重复的过滤掉,代码如下:

select * from tb_kline where isDuplicated([DT
,Code],FIRST)=false

但执行时报错如下:

The where clause [isDuplicated([ DT, Code ], FIRST) == 0] of a distributed/partitioned sql shouldn't use any aggregate or sequential function.

我上面那个语法,是哪里写错了吗?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

分布式表建议用context by去重:

select?top?1?*?from?tb_kline?context?by?DT,Code

如果要取最后一条记录,可以用limit -1:

select * from tb_kline context by DT, Code limit -1

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...