網(wǎng)站建設(shè)哪家好,找創(chuàng)新互聯(lián)!專注于網(wǎng)頁設(shè)計、網(wǎng)站建設(shè)、微信開發(fā)、小程序定制開發(fā)、集團(tuán)企業(yè)網(wǎng)站建設(shè)等服務(wù)項目。為回饋新老客戶創(chuàng)新互聯(lián)還提供了霍山免費建站歡迎大家使用!
下面講講關(guān)于如何合并MySQL兩行數(shù)據(jù)成一行,文字的奧妙在于貼近主題相關(guān)。所以,閑話就不談了,我們直接看下文吧,相信看完如何合并mysql兩行數(shù)據(jù)成一行這篇文章你一定會有所受益。
使用SUM函數(shù),加上GROUP BY人員ID就可以實現(xiàn)了:
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兩行數(shù)據(jù)成一行相關(guān)內(nèi)容,大家還有什么不明白的地方嗎?或者想要了解更多相關(guān),可以繼續(xù)關(guān)注我們的行業(yè)資訊板塊。