这是表的关系,数据库是类似于QQ的数据库。
我现在要修改,好友人数(count(*) from dbo.Relation where RelationStatus=0)大于20的所有QQ号等级+1(update QQuser set level=level+1)
我的问题是:这个update语句怎么写条件?
升级列数据与条件存在的表非同一表,where语句怎么写?
------解决方案--------------------
- SQL code
update a set level=level+1from QQuser awhere a.qqid in(select qqid from Relation where RelationStatus=0 group by qqid having count(*)>20)