日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

mysql中使用concat例子

發布時間:2025/3/15 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mysql中使用concat例子 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

數據庫為mysql,需要把舊門店記錄的note字段的資料追加到新門店的note資料的后面

舊記錄id為old_terminal_id,新記錄id為new_terminal_id,提供格式如下:

共有2000多需要轉換。

存在多條舊門店合并到同一個新門店的情況,最終新門店的note字段需要自己note原資料加上全部舊門店的note資料。

在excel中拼接SQL:

select @note1:=max(note) from cmdm_terminal a where a.terminal_id=149356;update cmdm_terminal set note=concat(note,@note1) where terminal_id=147611; select @note2:=max(note) from cmdm_terminal a where a.terminal_id=280149;update cmdm_terminal set note=concat(note,@note2) where terminal_id=147663; select @note3:=max(note) from cmdm_terminal a where a.terminal_id=291854;update cmdm_terminal set note=concat(note,@note3) where terminal_id=147692;......

?excel中是這樣寫的:

=CONCATENATE("select @note",A2,":=max(note) from cmdm_terminal a where a.terminal_id=",B2,";update cmdm_terminal set note=concat(note,@note",A2,") where terminal_id=",D2,";")

?

轉載于:https://www.cnblogs.com/powerwu/p/5163090.html

總結

以上是生活随笔為你收集整理的mysql中使用concat例子的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。