อ.MN เคยบอกผมไว้แบบนี้ครับ
![ยิงฟันยิ้ม ;D](https://hosxp.net/smf2/Smileys/default/grin.gif)
update patient set cid = (select replace(cardno,'-','') from ptcardno
where ptcardno.hn = patient.hn and ptcardno.cardtype='01' and ptcardno.cardno not like '1-1111-11111-11-%')
where hn in (select hn from ptcardno where ptcardno.hn = patient.hn
and ptcardno.cardtype='01' and ptcardno.cardno not like '1-1111-11111-11-%' )
and cid is null
and patient.hn between '0000013' and '0009111'