Hi Everyone,
I want to get the date from table so i used between and operator, it's working but it should get only in-between dates.... I want to get the from date till to date....Example:
Due Date
01/04/2012
02/04/2012
03/04/2012
04/04/2012
05/04/2012
if i used between and operators:
select * from tbl_name where Due Date between '02/04/1987' and '04/04/2012'...
Here only i got this O/P:
03/04/2012
04/04/2012... but i want to get
02/04/1987
03/04/2012
04/04/2012... This only i need....Just tell the solution...
Thanks In Advanced
Loading
Keyur NarkhiPosted Apr 9, 2012, 2:05 AM
You can use something like that,
DECLARE @StartDate DATETIME
DECLARE @EndDate DATETIME
SET @StartDate = '02/04/1924'
SET @EndDate = '04/04/2012'
SELECT OrderDate FROM Orders WHERE OrderDate BETWEEN @StartDate AND @EndDate
UNION
SELECT @StartDate
thanks
Keyur NarkhiPosted Apr 9, 2012, 1:44 AM
The start date not comes because that not in your table data.
you need to prepand the start date to your output.
thanks