Click here to Skip to main content
15,915,833 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
How can we find data from database between a particular start date and end date?
eg:
SQL
select * from table where 26-05-2010 and 26-05-2010

How can we find data from database between 26-05-2010 and 26-05-2013
Posted
Updated 8-May-13 22:39pm
v3

SQL
SELECT * FROM TabelName WHERE ColumnName BETWEEN '2010/02/25' and '2011/02/27'
 
Share this answer
 
v2
Comments
Tinu k Thomas 9-May-13 4:44am    
thanks for the answer but i need current date
M.Saied 9-May-13 4:48am    
use GETDATE()
You can use "between" or ">,<".
SQL
SELECT * FROM [TABLE] WHERE [DATEFIELDNAME] BETWEEN WHERE '2010/05/26' AND '2013/05/226'

-OR-
SQL
SELECT * FROM [TABLE] WHERE [DATEFIELDNAME] => '2010/05/26' AND [DATEFIELDNAME] =< '2013/05/26'


Good luck,
OI
 
Share this answer
 
v2
I suppose nobody have ever had a similar requirement, so you wouldn't be able to find anything just using Google[^].
 
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