advice

Поиск
Список
Период
Сортировка
От Andrei Ivanov
Тема advice
Дата
Msg-id Pine.LNX.4.58.0310222250520.31834@webdev.ines.ro
обсуждение исходный текст
Ответы Re: advice
Список pgsql-novice
Hello,
I have 2 tables with identical schemas.
What I have to do is insert in the 1st table all the rows from the
2nd table that don't exist in the 1st.

I'm planning to something like
INSERT INTO first_table
  SELECT * FROM second_table s WHERE
     NOT EXISTS (SELECT 1 FROM first_table WHERE id = s.id)

but I'm not sure this is the best way to do it...

Would anyone care to suggest a better query to do this ?

Thank you.


В списке pgsql-novice по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: index usage
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: advice