title: Laravel: Combining the results with UnionAll with count
body: <p>Lets just say I have 2 column in a table resume_profiles</p>
  
  <pre><code>   current_location      city
      | Chennai  |    | Kolkatta   |
      | Mumbai   |    | Ahmaedabad |
      | Pune     |    | Kolkatta   |
      | Kolkatta |    | Pune       |
  </code></pre>
  
  <p>I need to combine these result into a single SET, So I'd have something like this:</p>
  
  <pre><code>   City        Aggregate
  | Chennai    |    | 1 |
  | Mumbai     |    | 1 |
  | Pune       |    | 2 |
  | Kolkatta   |    | 3 |
  | Ahmaedabad |    | 1 |
  </code></pre>
  
  <p><strong>Query:</strong></p>
  
  <pre><code>$current_locations = ResumeProfile::selectRaw('current_location as city');
  
  ResumeProfile::selectRaw('city,count(*) as aggregate')
             -&gt;unionAll($current_locations)
             -&gt;groupBy('city')-&gt;get();
  </code></pre>
  
  <p>when i use the above query i'm getting the below query with the exception</p>
  
  <p><strong>SQLSTATE[21000]: Cardinality violation: 1222 The used SELECT statements have a different number of columns (SQL: (select city,count(*) as aggregate from <code>resume_profiles</code> group by <code>city</code>) union all (select current_location as city from <code>resume_profiles</code>))</strong></p>
  
  <p>I don't no how to achieve this</p>