Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Friends,
I am developing invoice application. In that i need to retrieve data from the database between two dates .

For Example:
I need to retrieve the data between 01/09/2012 to 10/09/2012 from the MsAccess database.

Thanks in Advance ..
Posted

C#
SELECT * FROM [TableName] WHERE datefrom <='09/01/2012' and dateto >= '09/10/2012'
 
Share this answer
 
v2
You can use Between too. as defined in above solution.

SQL
SELECT * FROM [TableName] WHERE datefrom>='09/01/2012' and datefrom<='09/10/2012'

Thanks
 
Share this answer
 
Comments
P.Vinoth 10-Oct-12 7:00am    
Friend Its only comparing the dates its not comparing the months please help me
AshishChaudha 10-Oct-12 7:51am    
I didn't understand your requirement.. The Query is working fine..
Try:
SQL
SELECT * FROM MyTable WHERE dateColumn BETWEEN '2012/09/01' AND '2012/09/10'
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900