Home > database >  SQL how to implement certain line summary according to certain conditions
SQL how to implement certain line summary according to certain conditions

Time:11-17

Existing table 1 as shown in figure 1, how to query statements it is concluded that the effect of figure 2,
Figure 1:

Figure 2:

CodePudding user response:

Suggested to build a temporary table, a table inside the serial number, name of the serial number, and then through the serial number coding characters like 'serial number %', and then sum, grouping

CodePudding user response:

Add two fields, work procedure name code and output are classified, such as, LB - 1 LB - 2 is classified as LB, such as a gong board, secondary classification gong gong plate plate, the grouping calculation is ok
  • Related