56,940
社区成员




select *
from table1
where a<b1 and b>a1
mysql> select * from NewTable;
+----+------------+------------+
| id | startdate | enddate |
+----+------------+------------+
| 1 | 2010-03-01 | 2010-05-31 |
| 2 | 2010-06-01 | 2010-07-31 |
| 3 | 2010-08-01 | 2010-08-31 |
+----+------------+------------+
3 rows in set (0.00 sec)
mysql> select * from NewTable where startdate<'2010-06-20' and enddate>'2010-04-01';
+----+------------+------------+
| id | startdate | enddate |
+----+------------+------------+
| 1 | 2010-03-01 | 2010-05-31 |
| 2 | 2010-06-01 | 2010-07-31 |
+----+------------+------------+
2 rows in set (0.00 sec)
mysql>