postgresql 中的 update 语句问题


postgresql中 update语句可以用limit 吗?


 sql


 update a set b =1  limit 1//报错,去掉limit 1 就没事

PostgreSQL 数据库

hwbest 9 years, 4 months ago

如果只是改一条数据,最好指定ID
update table set column=value where id = ?

如果没有ID就用where指定其他条件

VFIVE answered 9 years, 4 months ago

看了一下手册,update 命令里没提到 limit,所以应该是不可以的。

其实想想也挺正常的——你 update 和 limit 放一起是要干什么呢?

十六夜吃宵夜 answered 9 years, 4 months ago

Your Answer