Help with SQL

gtrapp
gtrapp used Ask the Experts™
on
I need to create a SQL statement that returns records within the current month. For example, the current month is July 2009 and there are 3 records with birthdays in July 2009. I need to return these records from the complete set that have birthdays in the month of July. Like below:

Betty            7/25/09
Nina            7/13/09
Jonh            7/3/09

Any suggestions? I am using SQL Server 2005.
Complete data set, with all records
 
Bob		1/13/09
Suzzy		2/22/09
Paul		4/17/09
Marry		5/2/09
Joe		6/12/09
Betty		7/25/09  <-- Return
Nina		7/13/09 <-- Return
Jonh		7/3/09  <-- Return
Joe		8/23/09
Becky		9/23/09
Mike		11/3/09
Lan		12/23/09
Emily		12/13/09

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
select * from table1 where month(dob) = month(getdate())
Commented:
SELECT name, birthdate
FROM yourTable
WHERE MONTH(birthdate) = MONTH(GETDATE())
Jagdish DevakuSr DB Architect
Commented:
try this...
SELECT name, birthdate
FROM yourTable
WHERE MONTH(birthdate) = 7

Open in new window

tigin44, thanks for reiterating my solution

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial