任何人都可以告诉我这个查询有什么问题吗?
String squery="update Room set GuestDetails.GuestCode=Room.GuestCode, GuestDetails.Title=Room.Title, GuestDetails.FirstName=Room.FirstName, GuestDetails.LastName=Room.LastName, GuestDetails.Country=Room.Country, GuestDetails.State=Room.State, GuestDetails.City=Room.City, GuestDetails.ContactNo=Room.ContactNo from GuestDetails inner join Room on Room.RoomNo="+rn+" and GuestCode="+gc+"";
我正在尝试更新Room并从GuestDetails中设置值。如果我输入GuestCode = 1,则GuestCode 1的访客应设置为RoomNo 101.请帮助我。
答案 0 :(得分:0)
我没有您的表格结构或数据,但请尝试如下
UPDATE Room
SET GuestDetails.GuestCode = Room.GuestCode,
GuestDetails.Title = Room.Title,
GuestDetails.FirstName = Room.FirstName,
GuestDetails.LastName = Room.LastName,
GuestDetails.Country = Room.Country,
GuestDetails.State = Room.State,
GuestDetails.City = Room.City,
GuestDetails.ContactNo = Room.ContactNo
where GuestDetails inner join Room on Room.RoomNo="+rn+" and GuestCode="+gc+
使用where
代替from