Reputation: 1108
Is it possible in MySql to do before and after in the same statement, my data is getting too large and i want to show only the data that has a date of 3 months before and 3 months after "FollowUp". It is date-time col. This is my statement..
select * from valuations
where Consultant = '$user'
and FollowedUp = 0 Order by FollowUp desc";
Upvotes: 0
Views: 67
Reputation: 745
Use this code
select * from valuations
where Consultant = '$user'
AND FollowUp >= NOW() - INTERVAL 3 MONTH
AND FollowUp <= NOW() + INTERVAL 3 MONTH
and FollowedUp = 0 Order by FollowUp desc";
Upvotes: 3