如何将PostgreSQL中的这两个查询合并为一个。 “NewUserAge”会从查询2中插入到字段时代吗?
SELECT max(age+1) as NewUserAge
FROM mytable;
INSERT INTO
mytable (age,name)
VALUES
(11,'Bert');
感谢您的帮助,
贝
答案 0 :(得分:1)
INSERT INTO mytable (age,name)
SELECT max(age) + 1, 'Bert'
FROM myTable