0

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

1 Answer 1

2
INSERT INTO mytable (age,name) 
SELECT  max(age) + 1, 'Bert'
FROM myTable
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.