Update UserGroup set UserID='02',GroupID=(select top 1 GroupID from GroupList where GroupName='一组') where UserID='01' and GroupID=(select top 1 GroupID from GroupList where GroupName='二组')
------解决方案--------------------------------------------------------
帮顶!!!!!!!!
------解决方案--------------------------------------------------------
看不出错误!!
------解决方案--------------------------------------------------------
lS说的对,如果不是access 那么说一下表的结构吧
------解决方案--------------------------------------------------------
将字段名 用中括号 括起来试下看。
如:Update UserGroup set [UserID]='02',[GroupID]=(select top 1 [GroupID] from GroupList where [GroupName]='一组') where [UserID]='01' and [GroupID]=(select top 1 [GroupID] from GroupList where [GroupName]='二组')
------解决方案--------------------------------------------------------
应该是因为Access不支持子查询
------解决方案--------------------------------------------------------
try:
update a set userid='02',groupid=c.groupid from UserGroup a,GroupList b,GroupList c where b.GroupName='二组' and c.GroupName='一组'
and a.UserID='01' and a.groupid=b.groupid
------解决方案--------------------------------------------------------
写sql最好到csdn的数据库论坛去问。
职业程序员不会乱写sql,最起码要知道inner join。