2
行
我有如下表:PHP和MySQL:查詢到 「和」 2個從PHP
+------------+-------+------------+-----------+
| date | time | custom_id | Number |
+------------+-------+------------+-----------+
| 01/17/2014 | 00:00 | ABC123 | 15 |
| 01/17/2014 | 00:00 | HEY567 | 25 |
| 01/17/2014 | 00:30 | ABC123 | 17 |
| 01/17/2014 | 00:30 | HEY567 | 28 |
| 01/17/2014 | 01:00 | ABC123 | 17 |
| 01/17/2014 | 01:00 | HEY567 | 28 |
| 01/17/2014 | 01:30 | ABC123 | 17 |
| 01/17/2014 | 01:30 | HEY567 | 28 |
+------------+-------+------------+-----------+
我怎樣才能和2行(總數)具有相同CUSTOM_ID & DATE當給定的時間只是:30分鐘的差異將它舍入到:00並刪除:30?它應該看起來像這樣到底:
+------------+-------+------------+-----------+
| date | time | custom_id | Number |
+------------+-------+------------+-----------+
| 01/17/2014 | 00:00 | ABC123 | 32 |
| 01/17/2014 | 00:00 | HEY567 | 53 |
| 01/17/2014 | 01:00 | ABC123 | 34 |
| 01/17/2014 | 01:00 | HEY567 | 56 |
+------------+-------+------------+-----------+
我該如何使用PHP或可能的MySQL查詢來完成此操作?
在此先感謝
SQLFiddle:http://sqlfiddle.com/#!2/cc529/1
你能提供sqlfiddle,這樣我們就可以測試解決方案? – user4035
當然我會立即創建它 – user3288852
這裏是SQLFiddle:http://sqlfiddle.com/#!2/cb8efb/1 – user3288852