0

Suppose I have two dates

  1. 2016-04-16 (yyyy-mm-dd)
  2. 2016-05-01(yyyy-mm-dd)

And I want to find birth date that falls between above two dates like birth date between '04-16'(mm-dd) and '05-01'(mm-dd)

Please help me to find this.

halfer
  • 19,824
  • 17
  • 99
  • 186

1 Answers1

0

Simply use Between

SELECT * FROM yourtable WHERE DateOfBirth BETWEEN '2016-04-16' AND '2016-05-01'

UPDATE
Try this, it'll ignore the year part, using Convert

SELECT
    *
FROM
    yourtable
WHERE
    CONVERT(varchar(5), DateOfBirth, 110) BETWEEN '04-16' AND '05-01'
Peter Szekeli
  • 2,712
  • 3
  • 30
  • 44