The first step is to join `staff` and `customer` together. The second step is to count the distinct product\_id. My target is to add the total(sum) field under the result table.
Thanks.

`staff`

```
staff_ID     Name     cust_id          
1            Tom       101   
1            Tom       101
1            Tom       105
2            Peter     102
2            Peter     104
3            Billy     103    

```

`customer`

```
cust_id    product_id        
101             A1
102             A2
103             A3
104             A4
105             A5

```

My work:

```
SELECT a.staff_name,COUNT(DISTINCT a.product_id)
FROM (SELECT distinct a.staff_id, a.staff_name, a.cust_id
     FROM staff)a
LEFT JOIN customer b ON a.cust_id=b.cust_id
GROUPBY a.staff_name

```

What I want is to add the **total** column below the count.

```
Name     count         
Tom       2   
Peter     2
Billy     1
Total     5  

```