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

Share and Enjoy:
  • Digg
  • StumbleUpon
  • del.icio.us
  • Twitter
  • Google Bookmarks
  • email
  • Technorati

Add Your Comments

Disclaimer
Your email is never published nor shared.
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>

Ready?