我有像
这样的数据Kysid date coloumn
1 2012-07-24 13:18:13
2 2012-07-24 13:18:12
3 2012-07-24 13:20:17
4 2012-07-24 13:20:34
5 2012-07-24 13:21:17
6 2012-07-24 13:21:34
从上面的数据我需要获得1,2,3,4列数据,秒数可以协商。我可以为此编写查询吗?
我的查询是
select * from table where date_coloumn between ('2012-07-24 13:20:34') and date_sub('2012-07-24 13:20:34',interval 2 minute)
。但它没有显示数据
答案 0 :(得分:0)
试试这个
SELECT *
FROM TABLE1
WHERE Date_coloumn BETWEEN '2012-07-24 13:18:00' AND '2012-07-24 13:20:00'
(OR)
SELECT *
FROM TABLE1
WHERE Date_coloumn >='2012-07-24 13:18:00' AND Date_coloumn <= '2012-07-24 13:20:00'