.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> Others >> Post New QuestionBookmark and Share Subscribe to Forum

How to get records from start date and end date of the month using MYSQL Query

Posted By: Suma     Posted Date: September 21, 2009    Points:2   Category :Others
Hi,
How to get records from start date and end date of the month using MYSQL Query. My Requirement is to get all the records falls under one given month.

For eg. Input month is May so i need to fetch all the records belong to may.

Thanks
Suma

Responses
Author: Lakhan Pal Garg             
Posted Date: September 21, 2009     Points: 5   

Hi suma-

use this Query :
SELECT * FROM {TableName} WHERE DATEPART(mm,DateFields)=WHERE DATEPART(mm,@YourDate) AND DATEPART(yy,DateFields)=WHERE DATEPART(yy,@YourDate)

Author: Faizal             
Posted Date: September 22, 2009     Points: 5   

Hi,

To get all the records between the one month you can use this MYSQL query


SELECT * FROM <TABLENAME> where <DATECOLUMN> between Date_SUB(curdate(), INTERVAL 30 DAY) and Date_SUB(curdate(), INTERVAL -1 DAY)


You can modify the above MYSQL query and pass your input date instead of curdate() in the above query.

Author: longwest             
Posted Date: June 18, 2015     Points: 20   

Related topic on stackoverflow may help you:
http://stackoverflow.com/questions/17014066/mysql-query-for-select-events-between-start-end-date

Best regards.
http://www.keepdynamic.com/



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend