Welcome Guest, Not a member yet? Register   Sign In
previous month records
#1

[eluser]Sawariya[/eluser]
Hi friends..
how to retrieve previous month records from mysql database table...

thanks in advance
#2

[eluser]Michael Wales[/eluser]
Code:
SELECT * FROM table WHERE MONTH(date_field) = MONTH(SUBDATE(CURDATE(), INTERVAL 1 MONTH))

I think that will work, just coming off the top of my head. Check out MySQL's date documentation.
#3

[eluser]Sawariya[/eluser]
Thank you Michael Wales..
#4

[eluser]Sawariya[/eluser]
thank you very much for your help....
#5

[eluser]Sawariya[/eluser]
One more doubt ..
how to get previous month name according to server date..
its not from databse,,,?? i think its possible ...
#6

[eluser]Sawariya[/eluser]
Hi Michael Wales
Thanks for your help..
This is working... but i its not checking year...




Theme © iAndrew 2016 - Forum software by © MyBB