MySQL Forums
Forum List  »  Newbie

sp vs query window
Posted by: Brian K
Date: April 23, 2014 04:28PM

I have a query as such:

SET @rownum := 0;

SELECT
rank
FROM
(SELECT
@rownum:=@rownum + 1 AS rank, devId, count(*) myc
from
picstr_tries
where
iscorrect = 1
and year(pttime) = year(now())
and month(pttime) = month(now())
and week(pttime) = week(now())
group by devid
order by myc desc) as result
WHERE
devid = '67395357e89197e6f0.5810528';

...but when I try this in a stored procedure and call it, it always returns 1.

When running the above in the query window, it returns the proper value.

What is it about the sp that makes it always return 1?

Options: ReplyQuote


Subject
Written By
Posted
sp vs query window
April 23, 2014 04:28PM
April 23, 2014 09:55PM
April 24, 2014 11:31AM
April 24, 2014 11:42AM
April 24, 2014 11:59AM
April 24, 2014 01:05PM
April 24, 2014 03:26PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.