<?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 Tip &#8211; Ordering by Date stored in a varchar field</title>
	<atom:link href="http://blogs.vinuthomas.com/2008/06/02/mysql-tip-ordering-by-date-stored-in-a-varchar-field/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.vinuthomas.com/2008/06/02/mysql-tip-ordering-by-date-stored-in-a-varchar-field/</link>
	<description>A Tech Discovery Blog on PHP, Ajax, Security and Social Media.</description>
	<lastBuildDate>Thu, 13 Oct 2011 13:51:09 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Getshashy1</title>
		<link>http://blogs.vinuthomas.com/2008/06/02/mysql-tip-ordering-by-date-stored-in-a-varchar-field/comment-page-1/#comment-40514</link>
		<dc:creator>Getshashy1</dc:creator>
		<pubDate>Thu, 10 Jun 2010 12:05:24 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.vinuthomas.com/?p=508#comment-40514</guid>
		<description>Good post buddy....Really Helpful.</description>
		<content:encoded><![CDATA[<p>Good post buddy&#8230;.Really Helpful.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vinu</title>
		<link>http://blogs.vinuthomas.com/2008/06/02/mysql-tip-ordering-by-date-stored-in-a-varchar-field/comment-page-1/#comment-39856</link>
		<dc:creator>vinu</dc:creator>
		<pubDate>Mon, 19 Oct 2009 06:54:19 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.vinuthomas.com/?p=508#comment-39856</guid>
		<description>@Mohamed Which version exactly do you use ? STR_TO_DATE should work on 3.23/4.0/4.1 according to the manual - http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functions.html#function_str-to-date</description>
		<content:encoded><![CDATA[<p>@Mohamed Which version exactly do you use ? STR_TO_DATE should work on 3.23/4.0/4.1 according to the manual &#8211; <a href="http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functions.html#function_str-to-date" rel="nofollow">http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functions.html#function_str-to-date</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vinu</title>
		<link>http://blogs.vinuthomas.com/2008/06/02/mysql-tip-ordering-by-date-stored-in-a-varchar-field/comment-page-1/#comment-39855</link>
		<dc:creator>vinu</dc:creator>
		<pubDate>Mon, 19 Oct 2009 06:53:15 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.vinuthomas.com/?p=508#comment-39855</guid>
		<description>@Mohamed Which version exactly do you use ?</description>
		<content:encoded><![CDATA[<p>@Mohamed Which version exactly do you use ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mohamed</title>
		<link>http://blogs.vinuthomas.com/2008/06/02/mysql-tip-ordering-by-date-stored-in-a-varchar-field/comment-page-1/#comment-39853</link>
		<dc:creator>Mohamed</dc:creator>
		<pubDate>Sun, 18 Oct 2009 10:31:12 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.vinuthomas.com/?p=508#comment-39853</guid>
		<description>i use version earllier than mysql 4.1 how can i do that</description>
		<content:encoded><![CDATA[<p>i use version earllier than mysql 4.1 how can i do that</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: yms</title>
		<link>http://blogs.vinuthomas.com/2008/06/02/mysql-tip-ordering-by-date-stored-in-a-varchar-field/comment-page-1/#comment-40459</link>
		<dc:creator>yms</dc:creator>
		<pubDate>Tue, 13 Oct 2009 10:07:06 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.vinuthomas.com/?p=508#comment-40459</guid>
		<description>Thanks man, you&#039;re my new hero!</description>
		<content:encoded><![CDATA[<p>Thanks man, you&#39;re my new hero!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: yms</title>
		<link>http://blogs.vinuthomas.com/2008/06/02/mysql-tip-ordering-by-date-stored-in-a-varchar-field/comment-page-1/#comment-39845</link>
		<dc:creator>yms</dc:creator>
		<pubDate>Tue, 13 Oct 2009 06:07:06 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.vinuthomas.com/?p=508#comment-39845</guid>
		<description>Thanks man, you&#039;re my new hero!</description>
		<content:encoded><![CDATA[<p>Thanks man, you&#39;re my new hero!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vinuthomas</title>
		<link>http://blogs.vinuthomas.com/2008/06/02/mysql-tip-ordering-by-date-stored-in-a-varchar-field/comment-page-1/#comment-39802</link>
		<dc:creator>vinuthomas</dc:creator>
		<pubDate>Thu, 14 May 2009 06:00:05 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.vinuthomas.com/?p=508#comment-39802</guid>
		<description>Thanks for your tip too Mario</description>
		<content:encoded><![CDATA[<p>Thanks for your tip too Mario</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mario</title>
		<link>http://blogs.vinuthomas.com/2008/06/02/mysql-tip-ordering-by-date-stored-in-a-varchar-field/comment-page-1/#comment-39801</link>
		<dc:creator>Mario</dc:creator>
		<pubDate>Wed, 13 May 2009 22:15:19 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.vinuthomas.com/?p=508#comment-39801</guid>
		<description>Thanks for sharing.&lt;br&gt;Just a note, you can also sort in this way by &quot;sort by&quot;&lt;br&gt;&lt;br&gt;Example&lt;br&gt;SELECT * FROM `TABLE`  ORDER BY STR_TO_DATE(date, &#039;%d.%m.%Y&#039;)  DESC&lt;br&gt;Regards</description>
		<content:encoded><![CDATA[<p>Thanks for sharing.<br />Just a note, you can also sort in this way by &#8220;sort by&#8221;</p>
<p>Example<br />SELECT * FROM `TABLE`  ORDER BY STR_TO_DATE(date, &#39;%d.%m.%Y&#39;)  DESC<br />Regards</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vinu</title>
		<link>http://blogs.vinuthomas.com/2008/06/02/mysql-tip-ordering-by-date-stored-in-a-varchar-field/comment-page-1/#comment-39491</link>
		<dc:creator>vinu</dc:creator>
		<pubDate>Wed, 03 Sep 2008 05:43:23 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.vinuthomas.com/?p=508#comment-39491</guid>
		<description>Thanks for sharing your tip Alain</description>
		<content:encoded><![CDATA[<p>Thanks for sharing your tip Alain</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alain Garcia</title>
		<link>http://blogs.vinuthomas.com/2008/06/02/mysql-tip-ordering-by-date-stored-in-a-varchar-field/comment-page-1/#comment-39490</link>
		<dc:creator>Alain Garcia</dc:creator>
		<pubDate>Tue, 02 Sep 2008 19:07:14 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.vinuthomas.com/?p=508#comment-39490</guid>
		<description>Thanks man!


I have a table (eventos) with 3 columns for store date:

one column for dia (day)
one column for  mes (mont)
one column for  ano (year)

I use this line:

SELECT * FROM (SELECT *, STR_TO_DATE( CONCAT(ano, &#039;-&#039;, mes, &#039;-&#039;, dia), &#039;%Y-%m-%d&#039; ) AS fecha FROM eventos) AS resultado 

I use this line to:

1. CONCAT the three columns in 1 column
2. convert this new column to  date format

Second example


I use this line:

SELECT * FROM (SELECT *, STR_TO_DATE( CONCAT(ano, &#039;-&#039;, mes, &#039;-&#039;, dia), &#039;%Y-%m-%d&#039; ) AS fecha FROM eventos) AS resultado WHERE fecha &gt;= &quot;2005-5-13&quot;  AND fecha = &quot;$date_1&quot;  AND fecha &lt;= &quot;$date_2&quot; ORDER BY fecha ASC</description>
		<content:encoded><![CDATA[<p>Thanks man!</p>
<p>I have a table (eventos) with 3 columns for store date:</p>
<p>one column for dia (day)<br />
one column for  mes (mont)<br />
one column for  ano (year)</p>
<p>I use this line:</p>
<p>SELECT * FROM (SELECT *, STR_TO_DATE( CONCAT(ano, &#8216;-&#8217;, mes, &#8216;-&#8217;, dia), &#8216;%Y-%m-%d&#8217; ) AS fecha FROM eventos) AS resultado </p>
<p>I use this line to:</p>
<p>1. CONCAT the three columns in 1 column<br />
2. convert this new column to  date format</p>
<p>Second example</p>
<p>I use this line:</p>
<p>SELECT * FROM (SELECT *, STR_TO_DATE( CONCAT(ano, &#8216;-&#8217;, mes, &#8216;-&#8217;, dia), &#8216;%Y-%m-%d&#8217; ) AS fecha FROM eventos) AS resultado WHERE fecha &gt;= &#8220;2005-5-13&#8243;  AND fecha = &#8220;$date_1&#8243;  AND fecha &lt;= &#8220;$date_2&#8243; ORDER BY fecha ASC</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Abenzoar UIcab</title>
		<link>http://blogs.vinuthomas.com/2008/06/02/mysql-tip-ordering-by-date-stored-in-a-varchar-field/comment-page-1/#comment-39472</link>
		<dc:creator>Abenzoar UIcab</dc:creator>
		<pubDate>Thu, 14 Aug 2008 18:30:44 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.vinuthomas.com/?p=508#comment-39472</guid>
		<description>Thank&#039;s man...
It hepl me for a little problem.
Regards...</description>
		<content:encoded><![CDATA[<p>Thank&#8217;s man&#8230;<br />
It hepl me for a little problem.<br />
Regards&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rodrigo</title>
		<link>http://blogs.vinuthomas.com/2008/06/02/mysql-tip-ordering-by-date-stored-in-a-varchar-field/comment-page-1/#comment-39183</link>
		<dc:creator>Rodrigo</dc:creator>
		<pubDate>Wed, 30 Jul 2008 13:36:56 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.vinuthomas.com/?p=508#comment-39183</guid>
		<description>hi, it is not the more elegant solution, but for small tables and when the client use text to save a date, it is useful.

Thanks</description>
		<content:encoded><![CDATA[<p>hi, it is not the more elegant solution, but for small tables and when the client use text to save a date, it is useful.</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: MySQL Error: 1062 Duplicate entry &#8216;0&#8242; for key 1 &#124; VT's Tech Blog</title>
		<link>http://blogs.vinuthomas.com/2008/06/02/mysql-tip-ordering-by-date-stored-in-a-varchar-field/comment-page-1/#comment-35214</link>
		<dc:creator>MySQL Error: 1062 Duplicate entry &#8216;0&#8242; for key 1 &#124; VT's Tech Blog</dc:creator>
		<pubDate>Wed, 18 Jun 2008 09:39:47 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.vinuthomas.com/?p=508#comment-35214</guid>
		<description>[...] MySQL Tip - Ordering by Date stored in a varchar field [...]</description>
		<content:encoded><![CDATA[<p>[...] MySQL Tip &#8211; Ordering by Date stored in a varchar field [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vinu</title>
		<link>http://blogs.vinuthomas.com/2008/06/02/mysql-tip-ordering-by-date-stored-in-a-varchar-field/comment-page-1/#comment-34860</link>
		<dc:creator>vinu</dc:creator>
		<pubDate>Sun, 15 Jun 2008 11:33:59 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.vinuthomas.com/?p=508#comment-34860</guid>
		<description>Satish,
You can use the following query

SELECT rows
FROM `table`
WHERE &#039;2006-12-13&#039;
BETWEEN STR_TO_DATE( vardatefield1, &#039;%Y-%m-%d&#039; )
AND STR_TO_DATE( vardatefield2, &#039;%Y-%m-%d&#039; )</description>
		<content:encoded><![CDATA[<p>Satish,<br />
You can use the following query</p>
<p>SELECT rows<br />
FROM `table`<br />
WHERE &#8217;2006-12-13&#8242;<br />
BETWEEN STR_TO_DATE( vardatefield1, &#8216;%Y-%m-%d&#8217; )<br />
AND STR_TO_DATE( vardatefield2, &#8216;%Y-%m-%d&#8217; )</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sathishkumar</title>
		<link>http://blogs.vinuthomas.com/2008/06/02/mysql-tip-ordering-by-date-stored-in-a-varchar-field/comment-page-1/#comment-34750</link>
		<dc:creator>sathishkumar</dc:creator>
		<pubDate>Sat, 14 Jun 2008 12:12:18 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.vinuthomas.com/?p=508#comment-34750</guid>
		<description>can u help me the convert varchar to date in mysql and also compare the date in between to and date</description>
		<content:encoded><![CDATA[<p>can u help me the convert varchar to date in mysql and also compare the date in between to and date</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic (Feed is rejected)
Page Caching using disk: enhanced
Database Caching 1/18 queries in 0.008 seconds using disk: basic
Object Caching 460/461 objects using disk: basic

Served from: blogs.vinuthomas.com @ 2012-02-09 04:47:36 -->
