pandemic pandemic - 1 year ago 73
MySQL Question

Before and After in mySql

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";

Answer Source

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"; 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download