小编Moj*_*jib的帖子

How to limit rows in PostgreSQL update statement

My table employees contain more than ten million data. i want to update 10k rows in commission_pct column where commission_pct is null and set zero(0) value.

in oracle I can easily solve this by using rownum.

update employees
set commission_pct=0
where commission_pct is null and rownum<=10000;
Run Code Online (Sandbox Code Playgroud)

but postgresql does not support rownum.

how to solve this in postgresql?

postgresql update

9
推荐指数
2
解决办法
1万
查看次数

标签 统计

postgresql ×1

update ×1