How to merge two rows of mysql data into one row
Let's talk about how to merge two rows of mysql data into one line. The secret of the text is that it is close to the topic. So, forget the gossip, let's go straight to the following, and I'm sure you'll benefit from reading this article on how to merge two rows of mysql data into one line.
Using the SUM function, plus the GROUP BY staff ID, you can do this:
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 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 Is there anything you don't understand about how to merge two rows of mysql data into one line? Or if you want to know more about it, you can continue to follow our industry information section.