对于包含int字段date,month和year的数据库表,查询大于指定日期的行的最佳方法是什么?
You can do:
select dateofbirth from customer Where DateofBirth BETWEEN date('1004-01-01') AND date('1980-12-31');
select dateofbirth from customer where date(dateofbirth)>date('1980-12-01');
select * from customer where date(dateofbirth) < date('now','-30 years');
通过简单的算术,您可以像这样进行选择:
SELECT * FROM t WHERE year*10000+month*100+day>20131021;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.