现有这样一张表:
biaozhi BJ name yw sx yy totals
100238 1 XXX 114 149 100
100649 1 YYY 123 129 103
想求出班级(BJ)里每个人的总分,并填写到totals列。mysql语言怎么写?
谢谢
biaozhi BJ name yw sx yy totals
100238 1 XXX 114 149 100
100649 1 YYY 123 129 103
想求出班级(BJ)里每个人的总分,并填写到totals列。mysql语言怎么写?
谢谢
(select BJ,biaozhi,sum(yw+sx+yy) as zs from tt group by BJ,biaozhi) b
on a.BJ=b.BJ and a.biaozhi=b.biaozhi
set a.totals=b.zs
set totals=yw+sx+yy;