我在蜂房里有两张像下面这样的桌子
+----+----------+----------+-----------+
| id | subject | date | amount|
+----+----------+----------+-----------+
| 1 | Do this | 10-10-13 | 20985 |
| 2 | Done this| 10-10-13 | 18657 |
| 3 | Dont do | 12-12-13 | 22039 |
+----+----------+----------+-----------+
表2:
+----+----------+----------+-----------+
| id | subject | date | amount|
+----+----------+----------+-----------+
| 1 | Do this | 10-10-13 | 10985 |
| 2 | Done this| 10-10-13 | 18657 |
| 3 | Dont do | 12-12-13 | 22039 |
| 4 | Do this | 10-10-13 | 10000 |
| 5 | Did this | 11-10-13 | 30000 |
+----+----------+----------+-----------+
group by subject and date
subject and date are Do this and 10-10-13
我得到的总数是一样的。
table 2
正在分组以匹配中的分组金额
table 1
我想要的结果是
+----+----------+----------+-----------+
| id | subject | date | amount|
+----+----------+----------+-----------+
| 1 | Do this | 10-10-13 | 10985 |
| 2 | Done this| 10-10-13 | 18657 |
| 3 | Dont do | 12-12-13 | 22039 |
| 4 | Do this | 10-10-13 | 10000 |
+----+----------+----------+-----------+
我怎样才能达到我想要的?