mysql - Insert statement with multiple rows include same selection field -


I need to insert multiple but this will be the same area of ​​all new records which is derived from another table: Include

  'user' (`id`,` name`, 'surname', 'retrieved') (zero, "a", "a", user_record SELECT id Where id = 1), (null, "b", "b", SELECT id from user_records where id = 1), (tap, "c", "c", user_cordes SELECT id where id = 1) ...  

I conform to every record This selection results without filing How can I combine?

Thanks

You should use a variable for that:

  SET @VAR: user_records WHERE id = 1 to SELECT ID; Values ​​(blank, "A", "A", @ VAR), (blank, "b", "b", @ "" `` `` user` (`id`,` name`, 'surname', ' Recover 'VAR'), (null, "C", "C", @VAR) ...  

or

  user_rcords in @VARE SELECT ID id = 1; Values ​​(blank, "A", "A", @ VAR), (blank, "b", "b", @ "" `` `` user` (`id`,` name`, 'Surname', 'retrieved' VAR), (tap, "c", "c", @ vaar) ...  

Comments