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:
prepare sqlfile adding clause each statement. should relatively easy favorite scripting language.
import temp "schema" , each table:
insert realtable select * temptable origin = 'import';
Comments
Post a Comment