Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cubespace/5274b12f27b628fa3cc13482248f7d9e to your computer and use it in GitHub Desktop.
Save cubespace/5274b12f27b628fa3cc13482248f7d9e to your computer and use it in GitHub Desktop.
Копировать выборочно данные из одной таблицы в другую
--example 1
INSERT INTO cheap_books (id, note)
SELECT id, 'Was in use'
FROM Books WHERE id > (SELECT MAX(id) FROM Books) - 3
--example2
INSERT INTO public.table1 (id_user, id_operator, status)
SELECT field1, 'field2', '300'
FROM tmp.table2 WHERE id = 33951632290
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment