Inserting from a select in MySQL

Quite simple but something I can never seem to remember:

INSERT INTO files_users (file_id, user_id) 
SELECT id, '2' FROM efs.files;

found @ http://mysql-tips.blogspot.com/2005/04/mysql-insert-select-example.html

Add Your Comments

Required
Required
Tips

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <ol> <ul> <li> <strong>

Your email is never published nor shared.

Ready?