选择从一年前到现在的所有记录

问题描述:

我有一个充满很多行的表,我需要选择到目前为止不到一年的所有行.

I have a table filled with a lot of rows and I need to select all the rows that are less than a year old till now.

表(称为orders)具有名为order_dateDateTime列,该列确定下订单的时间.

The table (called orders) has a DateTime column named order_date, that's the field that determines when the order was placed.

如何选择从现在到一年前的所有具有order_date的记录?

How can I select all the records that have an order_date between now and a full year ago?

select * 
from orders 
where order_date >= DATE_SUB(NOW(),INTERVAL 1 YEAR);