1 echo Create table t1(f1 timestamp, f2 timestamp);
2 Create table t1(f1 timestamp, f2 timestamp);
3 insert into t1 values('2001-01-01 01:01:01', '2001-05-05 05:01:01');
4 insert into t1 values('2002-01-01 01:01:01', '2002-03-05 05:01:01');
5 insert into t1 values('2003-01-01 01:01:01', '2003-03-05 05:01:01');
6 insert into t1 values('2004-01-01 01:01:01', '2004-03-05 05:01:01');
7 insert into t1 values('2005-01-01 01:01:01', '2005-01-05 05:01:01');
10 echo select * from t1 where timestamp_sub(f2 interval 4 hour) ='2003-03-05 01:01:01';
11 select * from t1 where timestamp_sub(f2 interval 4 hour) ='2003-03-05 01:01:01';
12 echo select * from t1 where timestamp_sub(f2 interval 4 hour)<='2003-03-05 01:01:01';
13 select * from t1 where timestamp_sub(f2 interval 4 hour)<='2003-03-05 01:01:01';
14 echo select * from t1 where timestamp_sub(f2 interval 4 hour) >'2003-03-05 01:01:01';
15 select * from t1 where timestamp_sub(f2 interval 4 hour) >'2003-03-05 01:01:01';
16 echo select * from t1 where timestamp_sub(f2 interval 244 hour) ='2001-04-25 01:01:01';
17 select * from t1 where timestamp_sub(f2 interval 244 hour) ='2001-04-25 01:01:01';
18 echo select * from t1 where timestamp_sub(f2 interval 244 hour)>='2001-04-25 01:01:01';
19 select * from t1 where timestamp_sub(f2 interval 244 hour)>='2001-04-25 01:01:01';
20 echo select * from t1 where timestamp_sub(f2 interval 244 hour) ='2002-02-23 01:01:01';
21 select * from t1 where timestamp_sub(f2 interval 244 hour) ='2002-02-23 01:01:01';
22 echo select * from t1 where timestamp_sub(f2 interval 244 hour)<='2002-02-23 01:01:01';
23 select * from t1 where timestamp_sub(f2 interval 244 hour)<='2002-02-23 01:01:01';
24 echo select * from t1 where timestamp_sub(f2 interval 244 hour) ='2004-02-24 01:01:01';
25 select * from t1 where timestamp_sub(f2 interval 244 hour) ='2004-02-24 01:01:01';
26 echo select * from t1 where timestamp_sub(f2 interval 244 hour)>='2004-02-24 01:01:01';
27 select * from t1 where timestamp_sub(f2 interval 244 hour)>='2004-02-24 01:01:01';
28 echo select * from t1 where timestamp_sub(f2 interval 960 hour) ='2004-11-26 05:01:01';
29 select * from t1 where timestamp_sub(f2 interval 960 hour) ='2004-11-26 05:01:01';
30 echo select * from t1 where timestamp_sub(f2 interval 960 hour)!='2004-11-26 05:01:01';
31 select * from t1 where timestamp_sub(f2 interval 960 hour)!='2004-11-26 05:01:01';