mysql 如何给变量赋一个动态sql执行的结果
在存储过程中DECLAREdt_idvarchar(32);SET@sqls=CONCAT('SELECTidFROMw_volume_detailWHEREv_id="...
在存储过程中
DECLARE dt_id varchar(32);
SET @sqls=CONCAT('SELECT id
FROM
w_volume_detail
WHERE
v_id = "',dd_id,'"AND uid IS NULL LIMIT 0,1');
prepare stms from @sqls;
execute stms;
想把上面sql执行的结果赋值给dt_id 展开
DECLARE dt_id varchar(32);
SET @sqls=CONCAT('SELECT id
FROM
w_volume_detail
WHERE
v_id = "',dd_id,'"AND uid IS NULL LIMIT 0,1');
prepare stms from @sqls;
execute stms;
想把上面sql执行的结果赋值给dt_id 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询