日期:2014-05-18  浏览次数:20880 次

sql语句中关于UPDATE的语法问题
请各位大侠给看下这句UPDATE的问题出在那边啊,因为是初学数据库,所以好多不懂,请多多指教
UPDATE The_Match_Data_OldBusToNewBus_by_Labels_shiyan SET (The_Match_Data_OldBusToNewBus_by_Labels_shiyan['Bus'],The_Match_Data_OldBusToNewBus_by_Labels_shiyan['Labe'])=(SELECT The_Match_Data_OldBusToNewBus_guize['New BusName'],The_Match_Data_OldBusToNewBus_guize['NEW Label'] FROM The_Match_Data_OldBusToNewBus_guize
上面这句话提示是语法错误,但是不知道错在那边,网上查了好几种办法也不好用啊……

------解决方案--------------------
SQL code

UPDATE The_Match_Data_OldBusToNewBus_by_Labels_shiyan SET The_Match_Data_OldBusToNewBus_by_Labels_shiyan['Bus']=(SELECT The_Match_Data_OldBusToNewBus_guize['New BusName'],The_Match_Data_OldBusToNewBus_guize['NEW Label'] FROM The_Match_Data_OldBusToNewBus_guize),The_Match_Data_OldBusToNewBus_by_Labels_shiyan['Labe']=(SELECT The_Match_Data_OldBusToNewBus_guize['NEW Label'] FROM The_Match_Data_OldBusToNewBus_guize)

------解决方案--------------------
看看你查的那个表里需要更新的数据存在么?
------解决方案--------------------
T-SQL update的语法是这样的

update tableName set 字段一=新的字段值,字段二=新的字段值,字段三=新的字段值..... where 字段N=新的字段值