<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: MySQL-Query: Howto select upcoming birthdays</title>
	<atom:link href="http://www.tsc-web.net/archive/2007/12/mysql-query-howto-select-upcoming-birthdays/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tsc-web.net/archive/2007/12/mysql-query-howto-select-upcoming-birthdays/</link>
	<description>Tobias Schlemmers Personal Homepage.</description>
	<lastBuildDate>Wed, 01 Feb 2012 09:54:59 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: smronju</title>
		<link>http://www.tsc-web.net/archive/2007/12/mysql-query-howto-select-upcoming-birthdays/comment-page-1/#comment-4182</link>
		<dc:creator>smronju</dc:creator>
		<pubDate>Wed, 01 Feb 2012 09:54:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.tsc-web.net/?p=106#comment-4182</guid>
		<description>Thanks you saved my day :)</description>
		<content:encoded><![CDATA[<p>Thanks you saved my day :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick</title>
		<link>http://www.tsc-web.net/archive/2007/12/mysql-query-howto-select-upcoming-birthdays/comment-page-1/#comment-4116</link>
		<dc:creator>Patrick</dc:creator>
		<pubDate>Wed, 30 Nov 2011 00:23:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.tsc-web.net/?p=106#comment-4116</guid>
		<description>Your query for the new_age has &quot;&gt;&quot; (greater than) instead. Yours is definitely better and more efficient.</description>
		<content:encoded><![CDATA[<p>Your query for the new_age has &#8220;>&#8221; (greater than) instead. Yours is definitely better and more efficient.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick</title>
		<link>http://www.tsc-web.net/archive/2007/12/mysql-query-howto-select-upcoming-birthdays/comment-page-1/#comment-4115</link>
		<dc:creator>Patrick</dc:creator>
		<pubDate>Wed, 30 Nov 2011 00:21:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.tsc-web.net/?p=106#comment-4115</guid>
		<description>I see now why we are having different results.

Your query has  instead. Yours is definitely better and more efficient.

Sorry for making a scene.

Thanks for your help though! :)</description>
		<content:encoded><![CDATA[<p>I see now why we are having different results.</p>
<p>Your query has  instead. Yours is definitely better and more efficient.</p>
<p>Sorry for making a scene.</p>
<p>Thanks for your help though! :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick</title>
		<link>http://www.tsc-web.net/archive/2007/12/mysql-query-howto-select-upcoming-birthdays/comment-page-1/#comment-4113</link>
		<dc:creator>Patrick</dc:creator>
		<pubDate>Tue, 29 Nov 2011 18:22:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.tsc-web.net/?p=106#comment-4113</guid>
		<description>Know what, sorry about the last comment. Obviously I&#039;m not 100% awake.

You are correct, the &quot;new_age&quot; for both #1 and #2 should be 12.

I&#039;ll try this out tonight when I get back home from work because I&#039;m a little busy at the moment. I&#039;ll let you know what I find out.

Thanks!</description>
		<content:encoded><![CDATA[<p>Know what, sorry about the last comment. Obviously I&#8217;m not 100% awake.</p>
<p>You are correct, the &#8220;new_age&#8221; for both #1 and #2 should be 12.</p>
<p>I&#8217;ll try this out tonight when I get back home from work because I&#8217;m a little busy at the moment. I&#8217;ll let you know what I find out.</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick</title>
		<link>http://www.tsc-web.net/archive/2007/12/mysql-query-howto-select-upcoming-birthdays/comment-page-1/#comment-4112</link>
		<dc:creator>Patrick</dc:creator>
		<pubDate>Tue, 29 Nov 2011 17:07:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.tsc-web.net/?p=106#comment-4112</guid>
		<description>Yes, thanks for that but if you look at your person #1, his birthday is 2000-01-04 and is 12 years old on 2011-11-25.

After 40 days however, he should be 13 years old (new_age).

The same is true for your person #2.

After 365 days, his &quot;new_age&quot; should be 13.</description>
		<content:encoded><![CDATA[<p>Yes, thanks for that but if you look at your person #1, his birthday is 2000-01-04 and is 12 years old on 2011-11-25.</p>
<p>After 40 days however, he should be 13 years old (new_age).</p>
<p>The same is true for your person #2.</p>
<p>After 365 days, his &#8220;new_age&#8221; should be 13.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tobias</title>
		<link>http://www.tsc-web.net/archive/2007/12/mysql-query-howto-select-upcoming-birthdays/comment-page-1/#comment-4104</link>
		<dc:creator>Tobias</dc:creator>
		<pubDate>Fri, 25 Nov 2011 20:04:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.tsc-web.net/?p=106#comment-4104</guid>
		<description>Thanks for your reply. But the statement as posted on the top is correct. Try it again with the following dates, and you should get the same results like me (supposed today is 2011-11-25):

&#124;&#124; *user_id* &#124;&#124; *birthday* &#124;&#124; *new_age* &#124;&#124; *days_to_birthday* &#124;&#124;
&#124;&#124; 1 &#124;&#124; 2000-01-04 &#124;&#124; 12 &#124;&#124; 40 &#124;&#124;
&#124;&#124; 2 &#124;&#124; 2000-11-24 &#124;&#124; 12 &#124;&#124; 365 &#124;&#124;
&#124;&#124; 3 &#124;&#124; 2000-11-25 &#124;&#124; 11 &#124;&#124; 0 &#124;&#124;
&#124;&#124; 4 &#124;&#124; 2000-11-26 &#124;&#124; 11 &#124;&#124; 1 &#124;&#124;

&lt;ul&gt;
	&lt;li&gt;#2 (who has had birthday yesterday) has to wait 365 more days. That means the leap year is taken into consideration: 2012-11-25 is 366 days from today.&lt;/li&gt;
	&lt;li&gt;#3 Happy birthday to you: you are getting 11 years old today. &lt;/li&gt;
	&lt;li&gt;#4 can celebrate his 11th birthday tomorrow.&lt;/li&gt;
	&lt;li&gt;#1 has to wait 40 more days until his 12th birthday.&lt;/li&gt;
&lt;/ul&gt;
</description>
		<content:encoded><![CDATA[<p>Thanks for your reply. But the statement as posted on the top is correct. Try it again with the following dates, and you should get the same results like me (supposed today is 2011-11-25):</p>
<p>|| *user_id* || *birthday* || *new_age* || *days_to_birthday* ||<br />
|| 1 || 2000-01-04 || 12 || 40 ||<br />
|| 2 || 2000-11-24 || 12 || 365 ||<br />
|| 3 || 2000-11-25 || 11 || 0 ||<br />
|| 4 || 2000-11-26 || 11 || 1 ||</p>
<ul>
<li>#2 (who has had birthday yesterday) has to wait 365 more days. That means the leap year is taken into consideration: 2012-11-25 is 366 days from today.</li>
<li>#3 Happy birthday to you: you are getting 11 years old today. </li>
<li>#4 can celebrate his 11th birthday tomorrow.</li>
<li>#1 has to wait 40 more days until his 12th birthday.</li>
</ul>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick</title>
		<link>http://www.tsc-web.net/archive/2007/12/mysql-query-howto-select-upcoming-birthdays/comment-page-1/#comment-4103</link>
		<dc:creator>Patrick</dc:creator>
		<pubDate>Fri, 25 Nov 2011 17:37:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.tsc-web.net/?p=106#comment-4103</guid>
		<description>~Here&#039;s the fix I was talking about~

For the line that says:

DATE_FORMAT(@today, &#039;%Y&#039;) - DATE_FORMAT(birthday, &#039;%Y&#039;) + IF(
DATE_FORMAT(birthday, &quot;%m%d&quot;) &lt; DATE_FORMAT(@today, &quot;%m%d&quot;), 1, 0) AS new_age,

I just replaced 0 with:

IF(DATE_FORMAT(birthday, &quot;%m%d&quot;) = DATE_FORMAT(@today, &quot;%m%d&quot;), 0, 1)</description>
		<content:encoded><![CDATA[<p>~Here&#8217;s the fix I was talking about~</p>
<p>For the line that says:</p>
<p>DATE_FORMAT(@today, &#8216;%Y&#8217;) &#8211; DATE_FORMAT(birthday, &#8216;%Y&#8217;) + IF(<br />
DATE_FORMAT(birthday, &#8220;%m%d&#8221;) &lt; DATE_FORMAT(@today, &quot;%m%d&quot;), 1, 0) AS new_age,</p>
<p>I just replaced 0 with:</p>
<p>IF(DATE_FORMAT(birthday, &quot;%m%d&quot;) = DATE_FORMAT(@today, &quot;%m%d&quot;), 0, 1)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick</title>
		<link>http://www.tsc-web.net/archive/2007/12/mysql-query-howto-select-upcoming-birthdays/comment-page-1/#comment-4102</link>
		<dc:creator>Patrick</dc:creator>
		<pubDate>Fri, 25 Nov 2011 17:06:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.tsc-web.net/?p=106#comment-4102</guid>
		<description>This is great, worked like a charm.
Although I found one little problem if the birthdate is next year.

Ex. Today is Nov 25 and the birthdate is Jan 4, the new_age is short by 1. I&#039;ll try fixing this on my own and hopefully I remember to post it here. Anyway, thanks!</description>
		<content:encoded><![CDATA[<p>This is great, worked like a charm.<br />
Although I found one little problem if the birthdate is next year.</p>
<p>Ex. Today is Nov 25 and the birthdate is Jan 4, the new_age is short by 1. I&#8217;ll try fixing this on my own and hopefully I remember to post it here. Anyway, thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mario</title>
		<link>http://www.tsc-web.net/archive/2007/12/mysql-query-howto-select-upcoming-birthdays/comment-page-1/#comment-4073</link>
		<dc:creator>Mario</dc:creator>
		<pubDate>Tue, 22 Feb 2011 17:56:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.tsc-web.net/?p=106#comment-4073</guid>
		<description>Another saved day! thank you!</description>
		<content:encoded><![CDATA[<p>Another saved day! thank you!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jamal</title>
		<link>http://www.tsc-web.net/archive/2007/12/mysql-query-howto-select-upcoming-birthdays/comment-page-1/#comment-4033</link>
		<dc:creator>jamal</dc:creator>
		<pubDate>Mon, 06 Dec 2010 11:50:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.tsc-web.net/?p=106#comment-4033</guid>
		<description>hey, you rock. I used your code and it&#039;s working fantastic.</description>
		<content:encoded><![CDATA[<p>hey, you rock. I used your code and it&#8217;s working fantastic.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

