Import into MySQL from SQL file, but only rows where field = value -


is there way /usr/bin/mysql or /usr/bin/mysqlimport import sql file exclude rows specific field doesn't have specific value?

i want restore data backup, backup data field "origin" has value "import". have script first deletes rows in live database "where origin = 'import'" , want import file rows have backed up, not every single row, since there other origins in backup.

am making myself clear? ideas?

two thoughts:

  1. prepare sqlfile adding clause each statement. should relatively easy favorite scripting language.

  2. import temp "schema" , each table:

    insert realtable  select * temptable origin = 'import'; 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -