<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>Hot Scripts Forums - Everything Java</title>
		<link>http://www.hotscripts.com/forums/</link>
		<description><![CDATA[System.out.print("Java, Java Servlets, and Java Applets");]]></description>
		<language>en</language>
		<lastBuildDate>Wed, 25 Nov 2009 12:50:23 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://cdn.hotscripts.com/forums/hsforum/misc/rss.jpg</url>
			<title>Hot Scripts Forums - Everything Java</title>
			<link>http://www.hotscripts.com/forums/</link>
		</image>
		<item>
			<title>applying Date range on string dates.</title>
			<link>http://www.hotscripts.com/forums/showthread.php?t=55768&amp;goto=newpost</link>
			<pubDate>Thu, 05 Nov 2009 09:13:04 GMT</pubDate>
			<description>hi folks, 
I have a table in mysql 5, which contains some date value (dd.mm.yyyy), but the column type is varchar. Now i want to query certain rows based on a given date range. 
 
My query is the following: 
 
 
Code: 
--------- 
SELECT integra_msg_monitor.msg_name, integra_msg_monitor.msg_date,...</description>
			<content:encoded><![CDATA[<div>hi folks,<br />
I have a table in mysql 5, which contains some date value (dd.mm.yyyy), but the column type is varchar. Now i want to query certain rows based on a given date range.<br />
<br />
My query is the following:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">SELECT integra_msg_monitor.msg_name, integra_msg_monitor.msg_date, integra_msg_monitor.msg_time FROM IntegraDB.integra_msg_monitor integra_msg_monitor where integra_msg_monitor.msg_date&nbsp; BETWEEN&nbsp; date_format(str_to_date('23.10.2009', '%d.%m.%Y'), '%d.%m.%Y') AND date_format(str_to_date('27.11.2009', '%d.%m.%Y'), '%d.%m.%Y')</code><hr />
</div>The problem is that not all the correct rows are returned. Few rows are missing, e.g. i have a row with dates like 04.11.2009, which is not returned by this above query.<br />
<br />
The problem in my opinion is that the BETWEEN clause is treating the dates as string (as the column type is varchar) and hence not returning the correct rows. <br />
<br />
So is there anyway to treat the string column as &quot;datatime&quot; at runtime and do the BETWEEN query in order to get the correct values within the given data range?<br />
<br />
Thanks.</div>

]]></content:encoded>
			<category domain="http://www.hotscripts.com/forums/forumdisplay.php?f=87">Everything Java</category>
			<dc:creator>sbutt</dc:creator>
			<guid isPermaLink="true">http://www.hotscripts.com/forums/showthread.php?t=55768</guid>
		</item>
	</channel>
</rss>
