代碼:存儲過程中
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 與查詢的衝突了