[thelist] SQL: Birthday report
Seth Bienek
evolt.list at sethbienek.com
Fri Oct 18 09:03:02 CDT 2002
I'm given a task of writing a report to display clients whose birthday
is within a provided date range. Sounds simple, right? It ain't.
I found a very good article on doing this in MySQL by evolt's very own
Rudy Limeback:
http://searchdatabase.techtarget.com/ateQuestionNResponse/0,289625,sid13
_cid458485_tax285649,00.html
The major problem with this approach being that I am using SQL Server
and the constructs he provides don't work with SQL server, specifically
this statement:
- ( RIGHT(DATE_ADD(CURRENT_DATE, INTERVAL 14 DAYS),5)
< RIGHT(birthdate,5)
Can someone (rudy maybe? :) explain what this does? I am assuming it
tells the DB to choose the greater of the two, but that's a guess, so I
could be completely off-track. Also, how can this be reconstructed for
SQL Server?
I am convinced that Rudy's approach is the most effective for getting
this done, if I can just get my hands around it; of course, I am open to
other approaches as well..
Any help is greatly appreciated!
Thanks,
Seth
More information about the thelist
mailing list