pgsql update select 查询并更新数据

复制代码
with t as (select id,
                  birthday,
                  identification,
                  substring(identification, 7, 8),
                  concat_ws('-', substring(substring(identification, 7, 8), 1, 4),
                            substring(substring(identification, 7, 8), 5, 2),
                            substring(substring(identification, 7, 8), 7, 2)
                      ) as a
           from app_public.users
           where
               identification is not null
               and
               identification != ''
           )
UPDATE app_public.users t1
SET birthday = t.a
FROM t
WHERE t1.id = t.id;

-- select * -- from t;

相关推荐
c238561 小时前
MySQL 基础用法(上):库表管理与数据增删改
c语言·数据库·c++·mysql
jnrjian2 小时前
postgres database 更换用户
数据库·postgresql
無a伟3 小时前
redis缓存完整详解
数据库·redis·缓存
G31135422734 小时前
大模型不可用时,业务还能不能继续:企业需要设计降级方案
大数据·服务器·数据库·人工智能·深度学习
VALENIAN瓦伦尼安教学设备5 小时前
激光对中仪采购要点
数据库·嵌入式硬件·算法
码农颜5 小时前
5.2.2 隔离级别
数据库·mysql
微三云 - 廖会灵 (私域系统开发)5 小时前
基于 OPC 流程控制的抖店集群 SaaS 平台设计与渠道分账系统实现
数据库
骇客野人5 小时前
MySQL 信创化迁移至 PolarDB-X 整体实施方案
数据库·mysql
影寂ldy6 小时前
SQL 事务(Transaction)完整版学习笔记(含转账案例+存储过程+异常捕获)
笔记·sql·学习
计科土狗6 小时前
GESP六级专题之类与对象
java·前端·数据库