Reputation: 2043
pardon for this silly question, seems its to late to think clear.
How can I combine these two Queries in PostgreSQL to one. That "NewUserAge" gets insert into field age from query two?
SELECT max(age+1) as NewUserAge
FROM mytable;
INSERT INTO
mytable (age,name)
VALUES
(11,'Bert');
Thanks for your help,
tony
Upvotes: 0
Views: 1019
Reputation: 263883
INSERT INTO mytable (age,name)
SELECT max(age) + 1, 'Bert'
FROM myTable
Upvotes: 2