title: Merge rows with same value of first column only in html table
body: <p>I have a dynamic html table, in which I want the rows in the first column only to be merged together if the values are same.<a href="https://i.stack.imgur.com/KGjmB.png" rel="nofollow noreferrer">Image of table</a>. In the first column, the first two row values are same, so they should be merged but the row values of third column should not be merged.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;table id="example1" class="table table-bordered"&gt;
    &lt;thead&gt;
      &lt;th class="hidden"&gt;&lt;/th&gt;
      &lt;th&gt;Area&lt;/th&gt;
      &lt;th&gt;Name&lt;/th&gt;
      &lt;th&gt;Party&lt;/th&gt;
      &lt;th&gt;Symbol&lt;/th&gt;
      &lt;th&gt;Total Number of Votes&lt;/th&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
      &lt;?php
                      $query="SELECT * FROM `candidates` ";
                      $result=mysqli_query($con,$query);
                      
                      while($row = mysqli_fetch_array($result)){
                        $sql1 = "SELECT `Name`,`Symbol` FROM `party` WHERE `Party_ID` = '".$row["Party_ID"]."' " ;
                        $query1 = $con-&gt;query($sql1);
                        $row1 = $query1-&gt;fetch_assoc();
                        $sql2 = "SELECT `Name` FROM `part` WHERE `Part_No` = '".$row["Part_No"]."' " ;
                        $query2 = $con-&gt;query($sql2);
                        $row2 = $query2-&gt;fetch_assoc();
                        $time1 = filemtime("../party/".$row['Symbol']);
                        echo "
                          &lt;tr&gt;
                            &lt;td class='hidden'&gt;&lt;/td&gt;
                            &lt;td&gt;".$row2['Name']."&lt;/td&gt;
                            &lt;td&gt;".$row['Name']."&lt;/td&gt;
                            &lt;td&gt;".$row1['Name']."&lt;/td&gt;
                            &lt;td&gt;&lt;img src='../party/".$row1['Symbol']."?".$time1."' alt='".$row1['Symbol']."' role='button' width='30px' height='30px' onclick='window.open(this.src)'&gt;&lt;/td&gt;
                            &lt;td&gt;".$row['Total_Votes']."&lt;/td&gt;
                          &lt;/tr&gt;
                        ";
                      }
                    ?&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;</code></pre>
  </div>
  </div>
  </p>