-- 使用变量@now存储
update t1 set t_date=NOW() where id=1 and @now=NOW();
-- 使用@now
select @now;
要使用上一条sql语句中的值,用用户变量存储起来。用户变量在一次会话内有效。
这里要避免重新查询刚刚更新的数据。
a772304419 ©著作权
-- 使用变量@now存储
update t1 set t_date=NOW() where id=1 and @now=NOW();
-- 使用@now
select @now;
要使用上一条sql语句中的值,用用户变量存储起来。用户变量在一次会话内有效。
这里要避免重新查询刚刚更新的数据。
MySQL优化查询的几种方式
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M