title: Error when aggregating due to conversion from varchar to bigint
body: <p><strong>Situation:</strong> </p>
  
  <p>I want to aggregate a value from a table but i get the following error :</p>
  
  <blockquote>
    <p>Error converting data type varchar to big int.</p>
  </blockquote>
  
  <p>I've been reading countless of different solutions online but they don't seem to solve it.</p>
  
  <p><strong>Current query;</strong>
  So based on the error message, i simply added the CAST function but it still doesnt work.</p>
  
  <pre><code>SELECT
      base.target_date AS target_date
    , base.game_id AS game_id                                                                                                 
    , base.device AS device
    , ISNULL(CAST(SUM(use_point.point) AS bigint),0) AS result                     
  FROM 
      cte AS base
  
  LEFT JOIN cte2 AS use_point         
      ON base.target_date = use_point.target_date 
      AND base.game_id = use_point.device
      AND base.device = use_point.device
  
  GROUP BY
      base.target_date 
    , base.device 
    , base.game_id
  WITH ROLLUP
  GO
  </code></pre>