简体   繁体   English

如何获取MySQL列中两个值之间的行?

[英]How to fetch rows between two values in a column MySQL?

I have saved dates in my MySQL table as VARCHAR format. 我已将日期以VARCHAR格式保存在MySQL表中。

I want to fetch rows between two dates. 我想获取两个日期之间的行。

SELECT * FROM orders WHERE date BETWEEN '01-02-2017' AND '28-02-2017'

This one didn't work. 这个没有用。 Is there any way to do that? 有什么办法吗?

  • Try This.. 尝试这个..
  • and store date data type as a date 并将日期数据类型存储为日期

select Date from emp_tbl where eid = 1 and Date >= '2016/03/31' and Date <= '2017/03/31' 从emp_tbl中选择日期,其中eid = 1且日期> ='2016/03/31'并且日期<='2017/03/31'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM