I have table like below

| `Pid` | `qid` | `count` | `sum` |
| --- | --- | --- | --- |
| 11 | 13 | 5 | 800 |
| 12 | 13 | 7 | 300 |
| 11 | 14 | 3 | 100 |
| 12 | 14 | 5 | 200 |

I need to get the difference of `sum` while doing `group by` using `pid` and `qid`

Like

```
SELECT
    /* ??? */
FROM
    tbl
GROUP BY
    pid,
    qid

```

| `Id1` | `id2` | `qid` | `difference` |
| --- | --- | --- | --- |
| 11 | 12 | 13 | 500 |