Forums

[SOLVED] Display only entries from last 30 days

sarkomand 11 Mar, 2013
Hi.

I have a custom CC listing. It currently shows all the entries. Is there a way to limit the results so that only the ones created in the last month are displayed?

I guess this should not be too complicated, but my knowledge of SQL is very very little.

Thanks!
GreyHead 11 Mar, 2013
Hi sarkomand,

You can use the WHERE box to filter the results.

Bob
sarkomand 11 Mar, 2013
Thanks.

Seems like I got it working with

cf_created BETWEEN CURDATE() - INTERVAL 30 DAY AND NOW()
GreyHead 14 Mar, 2013
Hi sarkoman,

Great; and good to know you can do that.

Bob
marcinwolejko 15 May, 2013
That's an awesome yet a pretty simple line of code that made my life easier.

However, a quick question. Will it work with specific dates, ie.
BETWEEN CURDATE() - (given date: 05-01-2013) AND NOW()
?
GreyHead 18 May, 2013
Hi marcinwolejko,

I think that this should work:
BETWEEN '2013-01-05' AND NOW()


Bob
marcinwolejko 24 May, 2013
Hi Bob

Thanks a lot for the code! Appreciated🙂
This topic is locked and no more replies can be posted.