我很难弄清楚如何命名这个,但这里有一个解释......
我有两张桌子
表格1:
--------------------------------------------------------------
| id | start | end | duration |
-------------------------------------------------------------
| 1 | 2013-10-01 09:00:00 | 2013-10-01 09:30:00 | 30 |
-------------------------------------------------------------
| 2 | 2013-10-02 10:00:00 | 2013-10-02 10:30:00 | 30 |
--------------------------------------------------------------
| int | datetime | datetime | int |
--------------------------------------------------------------
表#2:
---------------------------------------------------
| id | start | end |
---------------------------------------------------
| 3 | 2013-10-01 09:00:00 | 2013-10-01 17:00:00 |
---------------------------------------------------
| 4 | 2013-10-02 09:00:00 | 2013-10-02 17:00:00 |
---------------------------------------------------
| int | datetime | datetime |
---------------------------------------------------
我想要做的是从表#2 中获取所有记录,匹配任何在同一日期和同一日期时间内的表#1 行,并通过从表#1 中删除时间来修改结果集...
一个示例结果是......
---------------------------------------------------------
| table2id | start | end |
---------------------------------------------------------
| 3 | 2013-10-01 09:30:00 | 2013-10-01 17:00:00 |
---------------------------------------------------------
| 4 | 2013-10-02 09:00:00 | 2013-10-02 10:00:00 |
---------------------------------------------------------
| 4 | 2013-10-02 10:30:00 | 2013-10-02 17:00:00 |
---------------------------------------------------------
如何做到这一点?