求sql语句(100分)

  • 主题发起人 主题发起人 chenba
  • 开始时间 开始时间
C

chenba

Unregistered / Unconfirmed
GUEST, unregistred user!
一个表Room<br>fFormNo,fRoomNo<br>另一个表RoomCha<br>fFormNo,fRoomNoCha<br><br>如fFormNo相同,将fRoomNoCha的值替代fRoomNo
 
Update &nbsp;Room &nbsp; Set &nbsp;fRoomNo = <br>(Select &nbsp;fRoomNoCha &nbsp;From RoomCha &nbsp;Where RoomCha. fFormNo=Room.fFormNo ) <br>Where fFormNo &nbsp;in (Select fFormNo &nbsp;From RoomCha)
 
如果是MSSQL,我觉得应该这样写:<br><br>update Room set fRoomNo=RoomCha.fRoomNoCha<br>from RoomCha where Room.fFormNo=RoomCha.fFormNo
 
Update &nbsp;Room &nbsp; Set &nbsp;fRoomNo = <br>(Select &nbsp;fRoomNoCha &nbsp;From RoomCha ,room Where RoomCha. fFormNo=Room.fFormNo ) <br>Where fFormNo &nbsp;in (Select fFormNo &nbsp;From RoomCha)
 
update a <br>set a.fRoomNo=b.fRoomNoCha<br>from Room a ,RoomCha b<br>where a.fFormNo=b.fFormNo
 
谢谢各位:<br>最后采用jenhon的方法
 

Similar threads

后退
顶部