title: MySql query giving different result from editor and call statement
body: <p>I have a query which is producing different results while executing from Workbench editor and calling the stored procedure from editor using call statement </p>
  
  <p>The statement i am executing is as follows </p>
  
  <pre><code>SELECT 
      sum(PassCount) as PassCount, 
      sum(FailCount) as FailCount, 
      sum(NotAttempted) as NotAttempted, 
      sum(GoalAchieved) as GoalAchieved, 
      sum(B.AttemptCount) as AttemptCount, 
      @i as UserCount 
  FROM usergoalachievement A 
  JOIN userattemptcount B on B.GoalId=A.GoalId and B.UserProfileId=A.UserProfileId 
  WHERE B.UserProfileId in (select distinct UserProfileId from usergrouprole WHERE RoleId=4 and GroupId=29) 
  AND FIND_IN_SET(cast(A.GoalId as char),'30' ) and ifnull(ProgressionType,'')=ifnull(@progressionType,'PMP2') ; 
  </code></pre>
  
  <p>NULL, NULL, NULL, NULL, NULL, NULL </p>
  
  <p>now create a new procedure sp_test with the above statement and call the procedure using call statement from workbench as follows</p>
  
  <pre><code>call sp_test();
  </code></pre>
  
  <p>now the result will be as follows </p>
  
  <p>'63', '214', '99', '0', '363', '0' </p>
  
  <p>Why is this different for the same query (<strong>usergoalachievement, userattemptcount are views</strong>) </p>
  
  <p>again apart for creating the stored procedure there is no change in the statements in editor and stored proc. </p>
  
  <p>Can somebody explain why is this happening </p>
  
  <p>Thanks everybody</p>