MySQL 存儲過程執行結果與非存儲過程執行的結果不一樣

代碼:存儲過程中

set id_pds =(select count(s.user_id) from sys_user_role  as s where s.user_id=user_id_bl and s.role_id=bl_juese);
select CONCAT(id_pds,'|',user_id_bl,'|',bl_juese); 

結果:

 

代碼:外部查詢

select count(user_id) from sys_user_role where user_id=123 and role_id=101

結果:

 

 

花了兩個小時,才解決原來,改:

set id_pds =(select count(s.user_id) from sys_user_role  as s 
where s.user_id=user_id_bl and s.role_id=bl_juese);

 

原來我在上面聲明瞭user_id 與查詢的衝突了

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章