PostgreSQL 批量更新

PostgreSQL About 216 words

SQL

使用临时表实现批量更新

UPDATE sys_user 
SET username = tmp.username 
FROM
    (VALUES
        ( 1, 'zs-new' ),
        ( 2, 'ls-new' ),
        ( 3, 'ww-new' )
    ) AS tmp ( id, username ) 
WHERE
    sys_user.id = tmp.id;
Views: 402 · Posted: 2023-11-21

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

扫描下方二维码关注公众号和小程序↓↓↓

扫描下方二维码关注公众号和小程序↓↓↓


Today On History
Browsing Refresh