title: SQL query using UNIONS and GROUP BY
body: <p>The Query:</p>
  
  <pre><code>SELECT max(image_url), Model_Name
  FROM (
      SELECT max(image_url), Model_Name
      FROM dbo.proinfo_vodafone WHERE Brand_name='Nokia'
      UNION
      SELECT max(image_url), Model_Name
      FROM dbo.proinfo_3 WHERE Brand_name='Nokia' 
      UNION
      SELECT max(image_url), Model_Name
      FROM dbo.proinfo_t WHERE Brand_name='Nokia'
      UNION
      SELECT max(image_url), Model_Name
      FROM dbo.proinfo_o2 WHERE Brand_name='Nokia'
      UNION
      SELECT max(image_url), Model_Name 
      FROM dbo.proinfo_orange
      WHERE Brand_name='Nokia') AS temp
  WHERE Model_Name IS NOT NULL
  GROUP BY Model_Name
  ORDER BY Model_name ASC
  </code></pre>
  
  <p>Is giving the error: Msg 8155, Level 16, State 2, Line 3
  No column was specified for column 1 of 'temp'.</p>
  
  <p>Now, to be honest I'm not good with SQL, and I made this query by using Quick Replace in a similar query and I can't seem to understand what is wrong with the query.</p>
  
  <p>Please Help!
  Thanks in Advance.</p>
  
  <p>Anchit</p>