问题是这样的,
一个表中存放所有员工的基本信息,
uid yid
另外一个表中存放员工所用的卡号
uid kaid我想变更所有员工的卡号(kaid)为 000000+yid直接sql语句不会写了,请教老大了多谢 多谢!update kq_card_user set ka_id = '000000' + yidwhere uid in (select uid from YG_JiBen where yid is not null)
一个表中存放所有员工的基本信息,
uid yid
另外一个表中存放员工所用的卡号
uid kaid我想变更所有员工的卡号(kaid)为 000000+yid直接sql语句不会写了,请教老大了多谢 多谢!update kq_card_user set ka_id = '000000' + yidwhere uid in (select uid from YG_JiBen where yid is not null)
from kq_card_user as a inner join YG_JiBen as b
on a.uid = b.uid
set kaid=right('000000' + cast(yid as varchar(100)),6)
from kq_card_user A inner join 另外一个表名 B on A.UID= B.UID
set kaid=right('000000' + cast(yid as varchar(100)),6)
from kq_card_user A inner join 另外一个表名 B on A.UID= B.UID
update kq_card_user set ka_id ='000000'+(select yid from YG_JiBen where uid=k.uid)from kq_card_user k
update kq_card_user set kaid='000000'+rtrim(yid)
from YG_JiBen
where kq_card_user.uid=YG_JiBen.uid and YG_JiBen.yid is not null