# question

## find today´s birthdays in a query

Dear all, I have a question about a query in SQL. I have a table with people´s birthdays and I need a query to show a result of those people, who have birthday today. My idea was: SELECT T0.[peopleID], T0.[peopleName], T0.[peoplelastName], T0.[peoplebirthDate] FROM PEOPLETABLE T0 WHERE T0.[peoplebirthDate] = GETDATE() This query doesn´t show any results....where is my problem ?? Many thanks in advance kind regards.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

maybe You should use SELECT T0.[peopleID], T0.[peopleName], T0.[peoplelastName], T0.[peoplebirthDate] FROM PEOPLETABLE T0 WHERE T0.[peoplebirthDate] > CAST(DATEADD(DAY,-1,GETDATE()) as DATE) AND [peoplebirthDate] < CAST(DATEADD(DAY,1,GETDATE()) as DATE)

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

born between yesterday and tomorrow?
1 Like 1 ·
grater than yesterday and less then tommorow
0 Likes 0 ·
But... How many people in your PeopleTable were born (born) today? That's what this query is returning. Not how many people celebrate the *anniversary* of their birth...
0 Likes 0 ·
Because GETDATE() returns a datetime datatype, including ***the current time***. Birthdays are generally matched on the ***date*** alone. Also GETDATE() is now, today, current time. How many people in your table are born today? Does that give you enough to work out what's going wrong?
1 comment

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Thanks a lot... "sometimes you can´t see the trees in a forest" ;)
0 Likes 0 ·