Get the App
SLTechnology News&Howtos  ›  Database  › 

How to merge two rows of mysql data into one row

Shulou Source: shulou.com Published: 2022-06-01 19:11:08 10月03日 Update

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.

Tags: One line data following text topic people content function place mystery text more plate article industry information Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Microsoft vpn MariaDB Linux