D
D
des1roer2015-07-03 15:56:05
PostgreSQL
des1roer, 2015-07-03 15:56:05

Postgres 2 queries in one?

how to execute two requests with one request?

SELECT COALESCE(setval('techbase.item_id_seq', max(id)),nextval('techbase.item_id_seq'))  FROM techbase.item,
                    (SELECT 
                    nextval('techbase.item_id_seq')) as sel

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
des1roer, 2015-07-03
@des1roer

SELECT setval('techbase.item_id_seq', max(id)+1) FROM techbase.item,
                    (SELECT 
                    nextval('techbase.item_id_seq')) as sel

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question