title: Group output of SHOW COLUMNS into comma-delimited list
body: <p>I am comparing database tables on a development server against a live server, looking for column name changes, new columns, and columns that have been dropped.  I'd like to do something like this:</p>
  
  <pre><code>SELECT GROUP_CONCAT(Field) FROM (SHOW COLUMNS ON table_name) GROUP BY Field
  </code></pre>
  
  <p>What I am after is a comma-delimited list that I can then take to the live server and do:</p>
  
  <pre><code>SHOW COLUMNS FROM table_name WHERE NOT IN ([comma-delimited list from above query])
  </code></pre>
  
  <p>Any thoughts on how best to do this - either by correcting me in my own approach, or by another means all together?  Obviously, the above SQL does not work.</p>
  
  <p>A note: The servers are entirely separate and may not communicate with each other, so no direct comparison is possible.</p>
  
  <hr>
  
  <p><strong>EDIT</strong></p>
  
  <p>Thanks for the answers, guys!  Applying your answers to the question, this is my final SQL to get the column names:</p>
  
  <pre><code>SELECT CONCAT("'", GROUP_CONCAT(column_name ORDER BY ordinal_position SEPARATOR "', '"), "'") AS columns
  FROM information_schema.columns
  WHERE table_schema = 'db_name' AND table_name = 'tbl_name'
  </code></pre>
  
  <p>That gives me a list that looks like this:</p>
  
  <pre><code>'id', 'name', 'field1', 'field2'
  </code></pre>
  
  <p>Then I can use this query to compare:</p>
  
  <pre><code>SELECT GROUP_CONCAT(column_name ORDER BY ordinal_position)
  FROM information_schema.columns
  WHERE table_schema = 'db_name' AND table_name = 'tbl_name' AND column_name NOT IN ('id', 'name', 'field1', 'field2')
  </code></pre>
  
  <p>The results are a list of any columns that exist in the first database and not in the second.  Perfect!</p>