programming faqs interview questions tech technical educational freshers guide preparation interviews hr telephonic
try another color:
try another fontsize: 60% 70% 80% 90%
Programming FAQs

How to get the records posted in this month in mysql

Used the DATE_SUB function

Used the DATE_SUB function to get the records

select * from feed where updated > DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH)

To get the last month records
select * from feed where updated between
DATE_SUB(CURRENT_DATE, INTERVAL 2 MONTH) and DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH)

you can use INTERVAL 1 DAY, INTERVAL 1 WEEK, INTERVAL 2 MONTH ETC.,