小编Rev*_*lle的帖子

在 PostgreSQL 中使用 WHERE 子句执行 TABLESAMPLE

我想使用 TABLESAMPLE 从 PostgreSQL 满足特定条件的行中随机采样。

这运行良好:

select * from customers tablesample bernoulli (1);
Run Code Online (Sandbox Code Playgroud)

但我不知道如何将条件嵌入脚本中。例如这个

select * from customers where last_name = 'powell' tablesample bernoulli (1);
Run Code Online (Sandbox Code Playgroud)

抛出这个错误:

SQL 错误 [42601]:错误:“tablesample”位置或附近的语法错误
:71

postgresql query random table where

7
推荐指数
1
解决办法
5779
查看次数

标签 统计

postgresql ×1

query ×1

random ×1

table ×1

where ×1