|
EMP |
Name |
DOB |
Vijay |
1980-01-01 00:00:00 |
Bill |
1980-06-06 00:00:00 |
Kris |
1980-10-10 00:00:00 |
---- How to Find Rows Between Two Dates
DECLARE @startDate datetime
SET @startDate = '4/4/1980'
SELECT * FROM EMP_bwDate WHERE DOB between @startDate and '7/7/1980'
---- or
SELECT * FROM EMP_bwDate WHERE DOB between @startDate AND DATEADD(mm, 3, @startDate)
---- or
SELECT * FROM EMP_bwDate WHERE DOB >= @startDate AND DOB < DATEADD(mm, 3, @startDate)
Output |
Name |
DOB |
Bill |
1980-06-06 00:00:00 |
|