我有以下2個表:更新查詢從2表
table1中是tracsName,tracsid,N,NE...
表2是Tracs,kode,N2...
。我想用這個代碼改變N值與N2的值,N和更多的是風箭頭
更新查詢,可以更簡單嗎? UPDATE table1 SET N=(select N2 from table2 where tracs='daraname2' AND kode='1-6'), NE=(select NE2 from table2 where tracs='daraname2' AND kode='1-6'), E=(select E2 from table2 where tracs='daraname2' AND kode='1-6'), SE=(select SE2 from table2 where tracs='daraname2' AND kode='1-6'), S=(select S2 from table2 where tracs='daraname2' AND kode='1-6'), SW=(select SW2 from table2 where tracs='daraname2' AND kode='1-6'), W=(select W2 from table2 where tracs='daraname2' AND kode='1-6'), NW=(select NW2 from table2 where tracs='daraname2' AND kode='1-6') WHERE tracsName='daraname2' AND tracsid='1-6'
我有一個錯誤,如果你能給我的邏輯或代碼,它會很好。
哪些SQL? Mysql,sql服務器還是? –
對於mysql我使用mysql front, – Sae