我的表名是client_details,我的日期字段包含日期组,如
03/03/2015,04/13/2015,05/11/2015,06/08/2015,09/04/...
03/18/2015,04/28/2015,05/26/2015,06/23/2015,09/19/...
03/20/2015,04/30/2015,05/28/2015,06/25/2015,09/21/...
03/26/2015,05/06/2015,06/03/2015,07/01/2015,09/27/...
03/26/2015,05/06/2015,06/03/2015,07/01/2015,09/27/...
03/06/2015,04/16/2015,05/14/2015,06/11/2015,09/07/...
03/13/2015,04/23/2015,05/21/2015,06/18/2015,09/14/...
04/16/2015,05/27/2015,06/24/2015,07/22/2015,10/18/...
03/03/2015,04/13/2015,05/11/2015,06/08/2015,09/04/...
03/04/2015,04/14/2015,05/12/2015,06/09/2015,09/05/...
03/19/2015,04/29/2015,05/27/2015,06/24/2015,09/20/...
我想在' 03/26/2015'之间搜索一个日期。和' 2015年12月'。如何编写查询?
答案 0 :(得分:2)
你可以试试这个:
SELECT * FROM client_details WHERE `DateField` BETWEEN '03/26/2015' AND '05/12/2015';
修改: - 强>
因此,您的评论显示您通过用逗号分隔日期来存储日期。我会严厉劝阻这种做法,并建议你改变你的桌子的设计。这是一种存储日期的糟糕方式。
<强>理由:强>
替代解决方案: