Getting Different results from Query Editor and Stored Procedure
Hi All,
I have a query which is producing different results while executing from Workbench editor and calling the stored procedure from editor using call statement
The statement i am executing is as follows
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') ;
NULL, NULL, NULL, NULL, NULL, NULL
now create a new procedure sp_test with the above statement and call the procedure using call statement from workbench
now the result will be as follows
'63', '214', '99', '0', '363', '0'
Why is this different for the same query (usergoalachievement, userattemptcount are views)
again apart for creating the stored procedure there is no change in the statements in editor and stored proc.
Can somebody explain why is this happening
Thanks everybody