0

伙计们

我有一张附表

在此处输入图像描述

我们需要如下拨号代码字段

dialcode 列如下

id dialcode
640 1684
641 16842 
642 168473
643 1758
644 1758284
645 1758285 

基本上 parentid=0 的 dialcode 字段应该在 dialcode 字段中与 parentid<>0 的数字一起更新

例如 id=641 那么拨号代码将是 16842。

4

1 回答 1

0

试试这个..也许这是可能的答案

update table3 t1 left join table3 t2 on t1.parentid = t2.id  
set t1.dialcode = CONCAT(t2.dialcode,t1.number) where t1.parentid<> 0
于 2013-11-01T07:43:45.870 回答