Skip to main content
added 133 characters in body
Source Link
ypercubeᵀᴹ
  • 100k
  • 13
  • 217
  • 306

This is a very simple INSERT .. SELECT query.
Just

The id is not included in the column list as it has the AUTO_INCREMENT property and will get values automatically. You only need to replace 'aaa' with the menucardhash value that you want to duplicate from and and 'qqq' with the new value:

INSERT INTO menuship3 (headhash, menucardhash, menucathash, producthash) SELECT headhash, 'qqq', menucathash, producthash FROM menuship3 WHERE menucardhash = 'aaa' ; 

This is a very simple INSERT .. SELECT query.
Just replace 'aaa' with the menucardhash value that you want to duplicate from and and 'qqq' with the new value:

INSERT INTO menuship3 (headhash, menucardhash, menucathash, producthash) SELECT headhash, 'qqq', menucathash, producthash FROM menuship3 WHERE menucardhash = 'aaa' ; 

This is a very simple INSERT .. SELECT query.

The id is not included in the column list as it has the AUTO_INCREMENT property and will get values automatically. You only need to replace 'aaa' with the menucardhash value that you want to duplicate from and 'qqq' with the new value:

INSERT INTO menuship3 (headhash, menucardhash, menucathash, producthash) SELECT headhash, 'qqq', menucathash, producthash FROM menuship3 WHERE menucardhash = 'aaa' ; 
Source Link
ypercubeᵀᴹ
  • 100k
  • 13
  • 217
  • 306

This is a very simple INSERT .. SELECT query.
Just replace 'aaa' with the menucardhash value that you want to duplicate from and and 'qqq' with the new value:

INSERT INTO menuship3 (headhash, menucardhash, menucathash, producthash) SELECT headhash, 'qqq', menucathash, producthash FROM menuship3 WHERE menucardhash = 'aaa' ;