title: mysqldump with multiple tables with or without where clause
body: <p>I have a set of tables in my database that I have to take a dump ( :D ) of. My problem is I want to take some data from some tables that only date back certain days and would like to keep the remaining tables in tact.</p>
  
  <p>The query I came up with was something like:</p>
  
  <pre><code>mysqldump -h&lt;hostname&gt; -u&lt;username&gt; -p &lt;databasename&gt; 
  &lt;table1&gt; &lt;table2&gt; &lt;table3&gt; 
  &lt;table4&gt; --where 'created &gt; DATE_SUB(now(), INTERVAL 7 DAY)',
  &lt;table5&gt; --where 'created &gt; DATE_SUB(now(), INTERVAL 7 DAY)
  --single-transaction --no-create-info | gzip
  &gt; $(date +%Y-%m-%d-%H)-dump.sql.gz
  </code></pre>
  
  <p>The trouble with the above code is that table1, table2 and table3 will try to take the where clause of table4. I don't want that cause that would spit out an error that created field does not exist in these tables.</p>
  
  <p>I tried putting comma (,) after table names as I did after where clause but it doesn't work.</p>
  
  <p>At this point I'm pretty much stuck and have no more alternative expect create two different sql dump files, which I wouldn't want to do. </p>