1
INSERT INTO tableX (ColumnPk,column1, column2)
VALUES((SELECT  max(columnPk) from tableX)+1, 'Column1 value', 'Column2 Value')

I tried this but getting error 1093: You can't specify target table 'organizationmanagement' for update in FROM clause

Talha Ahmed Khan
  • 14,542
  • 10
  • 41
  • 48
Ankit Tater
  • 539
  • 3
  • 8
  • 25
  • possible duplicate of [In MySQL, can I copy one row to insert into the same table?](http://stackoverflow.com/questions/4039748/in-mysql-can-i-copy-one-row-to-insert-into-the-same-table) – Denis Rendler Feb 11 '14 at 11:38

1 Answers1

1

You don't use VALUES when you're using the result of SELECT:

INSERT INTO tableX (ColumnPk, column1, column2)
SELECT max(columnPk)+1, 'Column value', 'Column2 value';

Is there a reason you didn't configure columnPk as an auto-increment column, so it would do this automatically?

Barmar
  • 669,327
  • 51
  • 454
  • 560