I have a table that displays different colors and their quantities. I would like to merge rows with the same color into one row, with the total quantity shown in that row.
For instance, if there are 2 "black" colors with quantities of 5 and 2, I want to combine these two rows into one with the quantity field showing "5+2 = 7".
Here is an example of what I am looking for:
th{
border:1px solid black;
}
<table>
<thead>
<tr>
<th>Color</th>
<th>Rate</th>
<th>Qty</th>
</tr>
</thead>
<tbody>
<tr>
<td>white</td>
<td>1</td>
<td>0</td>
</tr>
<tr>
<td>Black</td>
<td>5</td>
<td>7</td>
</tr>
<tr>
<td>red</td>
<td>6</td>
<td>0</td>
</tr>
</tbody>
</table>