1

I have implement the SELECT multiple records and INSERT to another table in a stored procedure:

CREATE DEFINER=`root`@`localhost` PROCEDURE `publish`(IN `userid` MEDIUMINT)
    NO SQL
BEGIN

INSERT INTO `master_live`
(
    `Title`                  
)                      

   SELECT 
    `Title`
 FROM `breakingnewsmaster` WHERE user_id= userid;

END

How to get the multiple LAST_INSERT_ID() in stored procedure?

Thanks in advance

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
msvairam
  • 862
  • 5
  • 12
  • You can't get multiple insert IDs. You can get only **one** generated by the **last insert query**. – Mjh Jan 22 '16 at 15:28
  • Thanks, I unable to get the multiple insert IDs in store procedure. – msvairam Jan 23 '16 at 07:31
  • possible duplicate of http://stackoverflow.com/questions/4637367/mysql-last-insert-id-used-with-multiple-records-insert-statement . Short answer is, you can't. – ADyson Feb 15 '17 at 16:44

0 Answers0