birthdate prob

  • Thread starter Thread starter natashayin
  • Start date Start date
N

natashayin

Guest
i have this table which contain of the client brithdate.How can i extract the birthdate which fall on certain month that desired .
example:
birthdate:11/09/82
the month of the birth date is 11,how should i put in the sql statement?
 
Something like this (applied to Northwind's Employees table) could give you what you're after:

Code:
SELECT LastName, FirstName, DatePart("m",[BirthDate]) AS Expr1, DatePart("d",[BirthDate]) AS Expr2,
 Trim([firstname])+" "+[lastname] AS Expr3, DateSerial(Year(Now()),([Expr1]),[Expr2]) AS Birthday
 FROM Employees
 WHERE (((DatePart("m",[BirthDate]))=[enter month (1-12)]))
 ORDER BY DatePart("m",[BirthDate]), DatePart("d",[BirthDate]);
 
Use the month() function in the criteria:

SELECT ClientName, BirthDate
FROM yourTable
WHERE month(BirthDate)=11

This will extract those clients whose BirthDate fall on November.
 

Users who are viewing this thread

Back
Top Bottom