原始数据
| id | type | rid | pv | uv | company_id | group_id | device_id | date |
| 1 | portal | 0 | 35 | 16 | 55 | 121 | 235 | 2016-11-06 |
| 2 | portal | 0 | NULL | NULL | 55 | 119 | 236 | 2016-11-06 |
| 3 | portal | 0 | NULL | NULL | 55 | 66 | 238 | 2016-11-06 |
| 4 | portal | 0 | NULL | NULL | 55 | 66 | 238 | 2016-11-06 |
| 5 | portal | 0 | 2 | 1 | 55 | 119 | 239 | 2016-11-06 |
| 6 | portal | 0 | 22 | 9 | 55 | 107 | 240 | 2016-11-06 |
| 7 | portal | 0 | 22 | 9 | 55 | 107 | 240 | 2016-11-06 |
| 8 | portal | 0 | 35 | 18 | 55 | 117 | 241 | 2016-11-06 |
想要的结果:
根据device_id保留不重复记录
| id | type | rid | pv | uv | company_id | group_id | device_id | date |
| 1 | portal | 0 | 35 | 16 | 55 | 121 | 235 | 2016-11-06 |
| 2 | portal | 0 | NULL | NULL | 55 | 119 | 236 | 2016-11-06 |
| 3 | portal | 0 | NULL | NULL | 55 | 66 | 238 | 2016-11-06 |
| 5 | portal | 0 | 2 | 1 | 55 | 119 | 239 | 2016-11-06 |
| 6 | portal | 0 | 22 | 9 | 55 | 107 | 240 | 2016-11-06 |
| 8 | portal | 0 | 35 | 18 | 55 | 117 | 241 | 2016-11-06 |
然后求不重复记录的PV和
结果应该是94。
跪求大神解答