Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Sorting a list of dates..

Author  Topic 

Rarzie
Starting Member

2 Posts

Posted - 2002-06-04 : 10:05:42

Hi!

I'm working on a page that shows a listing of people who have their birthdays in the next week. The SQL below selects those people from the database. I'd like them to be ordered in a meaningful way (Day and month, since year not all that important when figuring out who's having his/her birthday first. :)

Any ideas?

select * from contact where datediff(dd, getdate(), dateadd(yy, datediff(yy, contGeboorte, getdate()), contGeboorte)) between 0 and 7

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-06-04 : 10:13:01
order by month(contgeboorte) asc, day(contceboorte) asc

<O>
Go to Top of Page

Rarzie
Starting Member

2 Posts

Posted - 2002-06-04 : 10:42:12
Thank you very much. :)

Go to Top of Page
   

- Advertisement -