how to format sub total and total from group by with roll up (so that they look different from other rows)

47 Views Asked by At

When i generate subtotal and total with group by roll up.Its generated desired result. But the problem which i am facing is that how can i format subtotal and total so that they look unqiue from details. With roll up its looks impossible. my mysql query is :

SELECT particular, id, sum(amount) amount
FROM TableName
GROUP BY particular, id WITH ROLLUP

OUTPUT

particular   amount
Fees         5000
Fees         3000
**sub tot        8000**
Bill         9000
Bill         3000
**sub           12000**
**Grand total  20000**

I tried this but failed to produce desire result

$query_run = mysqli_query($con, $query);

    if(mysqli_num_rows($query_run) > 0)
    {
        foreach($query_run as $row)
        {
            ?>
            <tr>
                <td><?= $row['id']; ?></td>
                <td><?= $row['particular']; ?></td>
                <td><?= $row['amount']; ?></td>

   </tr>

<tr><td><?= $row['sum(amount)']; ?></td></tr>
0

There are 0 best solutions below