MySQL数据库的update from 子查询使用方法_西安磁盘

日期:2014-07-13 / 人气: / 来源:网络

mssql 子查询更新

update log set uin= b.uin
from log a,logs b
where a.accountuin = b.accountuin

mysql 不支持 update 子查询更新

找了半天资料 终于搞定了...

update `log` a inner join `logs` b on a.`accountuin` = b.`accountuin`
set a.`uin` = b.`uin` where a.`accountuin` = b.`accountuin`

这样就能 将查询出来的字段批量更新过去了...

String sql="update jf_wares w INNER JOIN jf_order_detail od ON od.wares_id=w.wares_id  set w.surplus_num=IF(w.surplus_num>od.buy_count,w.surplus_num-od.buy_count,0) where od.order_id=? ";

MySQL数据库命令行使用方法

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=#最全的mysql登录方式:mysql -hIP -uUSENME -pPWD -PPORT DBNAME -e

MySQL安装

作者:管理员




现在致电4006-2991-90 OR 查看更多联系方式 →

Go To Top 回顶部