我有两张桌子,我想一起更新它们。我必须使用加入吗?
UPDATE tb_empgroc_master SET total_items='$total_items', total_amount='$total_amount' WHERE empgrocmstID='$empgrocmstID';
UPDATE tb_empgrocery SET qty_ordered='$qty_ordered', amount='$amount' WHERE empgrocID='$empgrocID';
这两个表具有相同的字段order_no
。
感谢您的帮助。
答案 0 :(得分:1)
试试这个:
<table border="0" cellpadding="1" cellspacing="1" style="width: 500px;">
<tbody>
<tr>
<td style="width: 300px;"> </td>
<td style="width: 100px; text-align: center;">Least</td>
<td style="width: 100px; text-align: center;">Most</td>
</tr>
<tr>
<td>{{question1}}</td>
<td style="text-align: center;"><input name="l1" type="radio" value="-1" /></td>
<td style="text-align: center;"><input name="m1" type="radio" value="1" /></td>
</tr>
<tr>
<td>{{question2}}</td>
<td style="text-align: center;"><input name="l1" type="radio" value="-2" /></td>
<td style="text-align: center;"><input name="m1" type="radio" value="2" /></td>
</tr>
<tr>
<td>{{question3}}</td>
<td style="text-align: center;"><input name="l1" type="radio" value="-3" /></td>
<td style="text-align: center;"><input name="m1" type="radio" value="3" /></td>
</tr>
<tr>
<td>{{question4}}</td>
<td style="text-align: center;"><input name="l1" type="radio" value="-4" /></td>
<td style="text-align: center;"><input name="m1" type="radio" value="4" /></td>
</tr>
</tbody>
答案 1 :(得分:0)
更新tb_empgroc_master t1,tb_empgrocery t2
设置t1.total_items ='$ total_items',t1.total_items ='$ total_amount',
t2.qty_ordered ='$ qty_ordered',t2.amount ='$ amount'
其中t1.order_no = t2.order_no;