Re: Birthday strategy

2005-08-25 Thread Gleb Paharenko
Hello. You're right. I haven't understood the problem properly. Terence <[EMAIL PROTECTED]> wrote: > Wouldnt that only work for the current year? For example I was born on > 1970-08-25, "select id from members where birthday = now();" wouldnt > return my birthday if it was today. Or a

Re: Birthday strategy

2005-08-25 Thread Pooly
Hi! Thanks for all your answers. I'll go for a flexible solution, with one column for day, one for month and if i want to compute the age, a year column. This will also give more flexibility if someone does not want to give his birthdate with precision (He would be able to only give the month, and

Re: Birthday strategy

2005-08-25 Thread Jigal van Hemert
Pooly wrote: Hi, I would like to display a list of members who have their birthday a given day (today for instance). For such an application I've used a single integer column to store a number consisting of the month and day (day as 2 digits!!!) concatenated. So dates range from 101 to 1231.

Re: Birthday strategy

2005-08-24 Thread Terence
Try to avoid running functions against columns, unless you have very little data, as it doesnt scale well (I'm talking 6 figure tables). Two options I can suggest are: 1. Write a scheduled job using your MONTH() DAY() to replace the values into a birthdays table on a daily basis 2. Use 2 sepera

Re: Birthday strategy

2005-08-24 Thread Terence
Wouldnt that only work for the current year? For example I was born on 1970-08-25, "select id from members where birthday = now();" wouldnt return my birthday if it was today. Or am I missing something new in 5.0.11? Gleb Paharenko wrote: Hello. Why don't you want to use just: select id

Re: Birthday strategy

2005-08-24 Thread Gleb Paharenko
Hello. Why don't you want to use just: select id from members where birthday = now(); See: mysql> show create table members\G; *** 1. row *** Table: members Create Table: CREATE TABLE `members` ( `id` int(11) NOT NULL auto_increment,

Re: Birthday strategy

2005-08-24 Thread Dan Baker
"Pooly" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hi, I would like to display a list of members who have their birthday a given day (today for instance). My idea is to store their birth date in a column, and then query the table against the column. But the query would be like :

Re: Birthday strategy

2005-08-24 Thread Pooly
2005/8/24, Cummings, Shawn (GNAPs) <[EMAIL PROTECTED]>: > > The 29th wouldn't be an issue because if that is their birthday -- and > today is 2/29 -- it will show up. It will only happen once every 4 years... I'll go with the two fields solution and make a special case for leap years. thanks for

Re: Birthday strategy

2005-08-24 Thread Jason Pyeron
table bday user int mon int day int On Wed, 24 Aug 2005, Pooly wrote: Hi, I would like to display a list of members who have their birthday a given day (today for instance). My idea is to store their birth date in a column, and then query the table against the column. But the query would be l

Birthday strategy

2005-08-24 Thread Pooly
Hi, I would like to display a list of members who have their birthday a given day (today for instance). My idea is to store their birth date in a column, and then query the table against the column. But the query would be like : select id from members where MONTH(birthday) = MONTH(NOW()) AND DAY(b