Skip to content

Instantly share code, notes, and snippets.

@egulhan
Created June 12, 2015 14:40
Show Gist options
  • Select an option

  • Save egulhan/47946a56c5bbf7118043 to your computer and use it in GitHub Desktop.

Select an option

Save egulhan/47946a56c5bbf7118043 to your computer and use it in GitHub Desktop.
Example of insert query from select query (including substr function using)
INSERT INTO tbl_media_files_tmf(entity_type_id,entity_id,file_name,media_type,sort_order,status,created_date,update_date)
SELECT CONCAT("37"),entity_id,CONCAT(substring_index(file_name,'.',1),'_mobile.jpg'),media_type,sort_order,status,created_date,update_date FROM tbl_media_files_tmf where entity_type_id=29;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment