下面讲讲关于如何合并mysql两行数据成一行,文字的奥妙在于贴近主题相关。所以,闲话就不谈了,我们直接看下文吧,相信看完如何合并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;
对于以上如何合并mysql两行数据成一行相关内容,大家还有什么不明白的地方吗?或者想要了解更多相关,可以继续关注我们的行业资讯板块。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。