表A 详细信息表
id .. ..
1
2
3表b aid表a得id
id day aid
1 2007-02-02 1
2 2007-02-03 1
3 2007-04-02 2
4 2007-04-06 2表c bid--表b得id
id dayfrom dayto bid
1 2007-02-02 8:00:00 2007-02-02 8:50:00 1
2 2007-02-03 9:20:00 2007-02-03 10:05:00 2
3 2007-02-02 8:00:00 2007-02-02 8:50:00 3
4 2007-04-06 9:20:00 2007-04-06 10:05:00 4
怎么根据表a得id更新表b的day 和 表c的dayfrom,dayto字段,只修改表c的dayfrom,dayto字段的日期,时间不修改?
id .. ..
1
2
3表b aid表a得id
id day aid
1 2007-02-02 1
2 2007-02-03 1
3 2007-04-02 2
4 2007-04-06 2表c bid--表b得id
id dayfrom dayto bid
1 2007-02-02 8:00:00 2007-02-02 8:50:00 1
2 2007-02-03 9:20:00 2007-02-03 10:05:00 2
3 2007-02-02 8:00:00 2007-02-02 8:50:00 3
4 2007-04-06 9:20:00 2007-04-06 10:05:00 4
怎么根据表a得id更新表b的day 和 表c的dayfrom,dayto字段,只修改表c的dayfrom,dayto字段的日期,时间不修改?
set dayfrom = b.day
,dayto= b.day
from c inner join b on b.id = c.bid
inner join a on b.aid = a.id
where a.id = ????
<tr>
<td align="center" background="images/lframe_t.gif" colspan="6" style="height: 20px">
修改值班表编排的起止日期</td>
</tr>
<tr>
<td align="right" rowspan="2">
请输入最新的起止日期:</td>
<td align="left" style="height: 20px">
开始日期:<asp:TextBox ID="TextBox1" runat="server" Width="193px" onmousedown="show_cele_date(this,'','',this);" size="10"></asp:TextBox>*(编排值班表从那号开始)</td>
</tr>
<tr>
<td align="left" style="height: 20px">
结束日期:<asp:TextBox ID="TextBox2" runat="server" Width="193px" onchange="checkdate();" onmousedown="show_cele_date(this,'','',this);" size="10"></asp:TextBox>*(编排值班表到那号结束)</td>
</tr>
<tr>
<td align="center" colspan="6" style="height: 20px">
<asp:Button ID="Button1" runat="server" Text="修改" OnClick="Button1_Click" />
</td>
</tr>
</table>
用户输入的开始日期和结束日期,只是日期年月日格式,但是点击修改之后,表c的数据也要改,但是表c中的时间不修改,因为另外一个修改要用到这个时间
set dayfrom = b.day
,dayto= b.day
from c inner join b on b.id = c.bid
inner join a on b.aid = a.id
where a.id = ????
参考这个,
另一条语句只能更新一张表,你可写两条sql
==>如果在C#中比较容易. DateTime dt0 = DateTime.Parse("2006-01-01 12:01:00");
DateTime dt1 = DateTime.Parse("2007-02-01 " + dt0.ToString("HH:mm:ss"));