mysql中update實現子查詢的方法
生活随笔
收集整理的這篇文章主要介紹了
mysql中update實現子查詢的方法
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
錯誤:
1 update account_list2 set PaidIn = select sum(Penalty) from pay_rec where CerID = '1006840113' and Processed = 0,
3 Way = '現金'
4 where PaidIn = 0.00;
?
正確:
1 update account_list a,2 (select sum(Penalty) as P from pay_rec where CerID = '1006840113' and Processed = 0 group by Processed) b
3 set a.PaidIn = b.P,
4 a.Way = '現金'
5 where a.BillID = '20120102160851';
轉載于:https://www.cnblogs.com/alex4814/archive/2012/01/02/2310318.html
與50位技術專家面對面20年技術見證,附贈技術全景圖總結
以上是生活随笔為你收集整理的mysql中update實現子查詢的方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: PHP中上传文件文件名乱码
- 下一篇: 关于EXCEL数据导入到SQLServe