The following PHP script joins two tables together and displays JSON based on the query. 

```
<?php

$con=mysqli_connect("localhost","username","password","dbName");

if (mysqli_connect_errno())
{
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

$sql =  "SELECT User, SUM(Price) as sumValue 
FROM Table1
LEFT JOIN Table2 USING(Product)
GROUP BY User";

if ($result = mysqli_query($con, $sql))
{

    $resultArray = array();
    $tempArray = array();

    while($row = $result->fetch_object())
    {
        $tempArray = $row;
        array_push($resultArray, $tempArray);
    }

    echo json_encode($resultArray);
}

mysqli_close($con);

?>

```

Because the query groups by the user, each user shows its own sumValue.

**And I get the following JSON results:**

```
[{"user":"Jack","sumValue":"4.50"},
{"user":"Jake","sumValue":" 4.00 "},{"user":"Mary","sumValue":" 8.50 "}] 

```

**How can I add a sum of all the `sumValue` and display them at the end of the JSON like:**

```
[{"user":"Jack","sumValue":"4.50"},
{"user":"Jake","sumValue":" 4.00 "},{"user":"Mary","sumValue":" 8.50 "}, 
{"sumTotal": "17.00"}]

```