如何从表中获取记录?但只有added_on >= '2014/03/01'
和added_on <= '2014/03/31'
目前我的sql表字段值为added_on = 2014/03/29 05:23:43
请尽快帮助我
答案 0 :(得分:1)
简单的SQL查询
select * from table_name where (added_on between '2014-03-01' and '2014-03-31' );
您可能还想指定hh:mm:ss
select * from table_name where (added_on between '2014-03-01 00:00:00' and '2014-03-31 00:00:00' );
两者都应该有用。 :)
答案 1 :(得分:0)
SELECT *
FROM [table]
WHERE CONVERT(datetime, [added_on]) between '2014/03/01' AND '2014/03/31'
答案 2 :(得分:0)
试试这个
SELECT *
FROM `table_name`
WHERE DATE(added_on) BETWEEN '2014/03/01' AND '2014/03/31'