标签:mysql
使用SUM函数,加上GROUP BY人员ID就可以实现了:
SELECT SUM(PZ+CPJS+BZ+GC+SB+TG+MJ+CL+CCLW+GJ+ZL+CBZZ) as count, SUM(PZ) as PZ,SUM(CPJS) as CPJS,SUM(BZ) as BZ,SUM(GC) as GC,SUM(SB) as SB,SUM(TG) as TG,SUM(MJ) as MJ,SUM(CL) as CL,SUM(CCLW) as CCLW,SUM(GJ) as GJ,SUM(ZL) as ZL,SUM(CBZZ) as CBZZ,SUM(YHID) as YHID,SUM(DJRMC) as DJRMC FROM tableName WHERE YHID=‘$ID‘ AND NF=‘$NF‘ GROUP BY YHID;
本文出自 “w1sw” 博客,请务必保留此出处http://cfdeng.blog.51cto.com/9873532/1944324
标签:mysql
原文地址:http://cfdeng.blog.51cto.com/9873532/1944324