title: MySql SELECT union for different columns?
body: <p>I have a select query that selects files with a thumbnail file attached and I also need to get those with no thumbnail attached.</p>
  
  <p>My current sql query is</p>
  
  <pre><code>SELECT   node.title, node.nid, files.fid, files.filepath, 
           content_type_mobile_event.field_date_value, 
           content_type_mobile_event.field_movie_shorts_value, 
           content_type_mobile_event.field_director_value, 
           content_type_mobile_event.field_length_value, 
           content_type_mobile_event.field_movie_type_value, 
           content_type_mobile_event.field_year_value, 
           content_type_mobile_event.field_event_type_value, 
           content_type_mobile_event.field_movie_location_value, 
           content_type_mobile_event.field_movie_desc_value, 
           content_type_mobile_event.field_movie_id_value, 
           content_type_mobile_event.field_movie_thumb_fid, 
           content_type_mobile_event.field_movie_trailer_url 
  FROM     node, content_type_mobile_event, files 
  WHERE    node.nid=content_type_mobile_event.nid AND 
           content_type_mobile_event.field_movie_thumb_fid=files.fid 
  ORDER BY content_type_mobile_event.field_date_value ASC
  </code></pre>
  
  <p>I need to also get</p>
  
  <pre><code>SELECT   node.title, node.nid, content_type_mobile_event.field_date_value, 
           content_type_mobile_event.field_movie_shorts_value, 
           content_type_mobile_event.field_director_value, 
           content_type_mobile_event.field_length_value, 
           content_type_mobile_event.field_movie_type_value, 
           content_type_mobile_event.field_year_value, 
           content_type_mobile_event.field_event_type_value, 
           content_type_mobile_event.field_movie_location_value, 
           content_type_mobile_event.field_movie_desc_value, 
           content_type_mobile_event.field_movie_id_value, 
           content_type_mobile_event.field_movie_thumb_fid, 
           content_type_mobile_event.field_movie_trailer_url 
  FROM     node, content_type_mobile_event 
  WHERE    node.nid=content_type_mobile_event.nid AND
           content_type_mobile_event.field_movie_thumb_fid!=1 
  ORDER BY content_type_mobile_event.field_date_value ASC
  </code></pre>
  
  <p>I would normally just do a</p>
  
  <pre><code>(
  SELECT   node.title, node.nid, files.fid, files.filepath, 
           content_type_mobile_event.field_date_value, 
           content_type_mobile_event.field_movie_shorts_value, 
           content_type_mobile_event.field_director_value, 
           content_type_mobile_event.field_length_value, 
           content_type_mobile_event.field_movie_type_value, 
           content_type_mobile_event.field_year_value, 
           content_type_mobile_event.field_event_type_value, 
           content_type_mobile_event.field_movie_location_value, 
           content_type_mobile_event.field_movie_desc_value, 
           content_type_mobile_event.field_movie_id_value, 
           content_type_mobile_event.field_movie_thumb_fid, 
           content_type_mobile_event.field_movie_trailer_url 
  FROM     node, content_type_mobile_event, files 
  WHERE    node.nid=content_type_mobile_event.nid AND 
           content_type_mobile_event.field_movie_thumb_fid=files.fid 
  ORDER BY content_type_mobile_event.field_date_value ASC
  )
  UNION
  (
  SELECT   node.title, node.nid, content_type_mobile_event.field_date_value, 
           content_type_mobile_event.field_movie_shorts_value, 
           content_type_mobile_event.field_director_value, 
           content_type_mobile_event.field_length_value, 
           content_type_mobile_event.field_movie_type_value, 
           content_type_mobile_event.field_year_value, 
           content_type_mobile_event.field_event_type_value, 
           content_type_mobile_event.field_movie_location_value, 
           content_type_mobile_event.field_movie_desc_value, 
           content_type_mobile_event.field_movie_id_value, 
           content_type_mobile_event.field_movie_thumb_fid, 
           content_type_mobile_event.field_movie_trailer_url 
  FROM     node, content_type_mobile_event 
  WHERE    node.nid=content_type_mobile_event.nid AND 
           content_type_mobile_event.field_movie_thumb_fid!=1 
  ORDER BY content_type_mobile_event.field_date_value ASC
  )
  </code></pre>
  
  <p>But the problem is the second one has a different set of columns (minus the files.* part)</p>
  
  <p>I cannot for the life of me figure out how to do this.</p>