<?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 function to find distance between two places using lat/long</title>
	<atom:link href="http://www.imranulhoque.com/mysql/mysql-function-to-find-distance-between-two-places-using-latlong/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.imranulhoque.com/mysql/mysql-function-to-find-distance-between-two-places-using-latlong/</link>
	<description></description>
	<lastBuildDate>Fri, 03 Feb 2012 12:09:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Imran</title>
		<link>http://www.imranulhoque.com/mysql/mysql-function-to-find-distance-between-two-places-using-latlong/comment-page-1/#comment-5683</link>
		<dc:creator>Imran</dc:creator>
		<pubDate>Tue, 17 Jan 2012 04:13:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.imranulhoque.com/?p=89#comment-5683</guid>
		<description>Do not ignore the warning. Better you should change the distance to DECIMAL(18,12) otherwise it may return some distorted result.

I have updated the function, please update it. Thanks for pointing it out.</description>
		<content:encoded><![CDATA[<p>Do not ignore the warning. Better you should change the distance to DECIMAL(18,12) otherwise it may return some distorted result.</p>
<p>I have updated the function, please update it. Thanks for pointing it out.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephen</title>
		<link>http://www.imranulhoque.com/mysql/mysql-function-to-find-distance-between-two-places-using-latlong/comment-page-1/#comment-5682</link>
		<dc:creator>Stephen</dc:creator>
		<pubDate>Mon, 16 Jan 2012 22:59:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.imranulhoque.com/?p=89#comment-5682</guid>
		<description>The code function works great for me.  The only problem is that I am getting the following warning:

Data truncated for column &#039;distance&#039; at row X

where X is the row number.  It appears that the variable distance is being truncated because it is too large for type DECIMAL(12,8).  I am wondering if I should turn the warnings off or make a change to DECIMAL.</description>
		<content:encoded><![CDATA[<p>The code function works great for me.  The only problem is that I am getting the following warning:</p>
<p>Data truncated for column &#8216;distance&#8217; at row X</p>
<p>where X is the row number.  It appears that the variable distance is being truncated because it is too large for type DECIMAL(12,8).  I am wondering if I should turn the warnings off or make a change to DECIMAL.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Imran</title>
		<link>http://www.imranulhoque.com/mysql/mysql-function-to-find-distance-between-two-places-using-latlong/comment-page-1/#comment-5674</link>
		<dc:creator>Imran</dc:creator>
		<pubDate>Sat, 10 Dec 2011 02:01:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.imranulhoque.com/?p=89#comment-5674</guid>
		<description>In your query,

select ZipCode from zip where GetDistance(&quot;10.1357002, 49.9225563, 0&quot;, (  &lt;strong&gt;select concat_ws(’, ’, Longitude, Latitude, ’0’) from zip&lt;/strong&gt;  )) &lt;= 40;

you can see it can return multiple results as there is no condition to limit the number of result to be one. Try the following if that helps:

&lt;blockquote&gt;select ZipCode from zip where GetDistance(&quot;10.1357002, 49.9225563, 0&quot;, concat_ws(’, ’, Longitude, Latitude, ’0’)) &lt;= 40;&lt;/blockquote&gt;

Thanks
Imran</description>
		<content:encoded><![CDATA[<p>In your query,</p>
<p>select ZipCode from zip where GetDistance(&#8220;10.1357002, 49.9225563, 0&#8243;, (  <strong>select concat_ws(’, ’, Longitude, Latitude, ’0’) from zip</strong>  )) &lt;= 40;</p>
<p>you can see it can return multiple results as there is no condition to limit the number of result to be one. Try the following if that helps:</p>
<blockquote><p>select ZipCode from zip where GetDistance(&#8220;10.1357002, 49.9225563, 0&#8243;, concat_ws(’, ’, Longitude, Latitude, ’0’)) &lt;= 40;</p></blockquote>
<p>Thanks<br />
Imran</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephen</title>
		<link>http://www.imranulhoque.com/mysql/mysql-function-to-find-distance-between-two-places-using-latlong/comment-page-1/#comment-5672</link>
		<dc:creator>Stephen</dc:creator>
		<pubDate>Fri, 09 Dec 2011 15:01:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.imranulhoque.com/?p=89#comment-5672</guid>
		<description>Imran,

I am trying to use a non-scalar value for the value of \&quot;coordinates\&quot; in your example above, and it is not working.  How do you use the function in a query of a table where \&quot;coordinates\&quot; is a non-scalar query?  My query is below:

mysql&gt; select ZipCode from zip where GetDistance(\&quot;10.1357002, 49.9225563, 0\&quot;, (select concat_ws(\&#039;, \&#039;, Longitude, Latitude, \&#039;0\&#039;) from zip)) &lt;= 40;
ERROR 1242 (21000): Subquery returns more than 1 row</description>
		<content:encoded><![CDATA[<p>Imran,</p>
<p>I am trying to use a non-scalar value for the value of \&quot;coordinates\&quot; in your example above, and it is not working.  How do you use the function in a query of a table where \&quot;coordinates\&quot; is a non-scalar query?  My query is below:</p>
<p>mysql&gt; select ZipCode from zip where GetDistance(\&quot;10.1357002, 49.9225563, 0\&quot;, (select concat_ws(\&#8217;, \&#8217;, Longitude, Latitude, \&#8217;0\&#8217;) from zip)) &lt;= 40;<br />
ERROR 1242 (21000): Subquery returns more than 1 row</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephen</title>
		<link>http://www.imranulhoque.com/mysql/mysql-function-to-find-distance-between-two-places-using-latlong/comment-page-1/#comment-5671</link>
		<dc:creator>Stephen</dc:creator>
		<pubDate>Fri, 09 Dec 2011 15:00:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.imranulhoque.com/?p=89#comment-5671</guid>
		<description>Imran,

I am trying to use a non-scalar value for the value of &quot;coordinates&quot; in your example above, and it is not working.  How do you use the function in a query of a table where &quot;coordinates&quot; is a non-scalar query?  My query is below:

mysql&gt; select ZipCode from zip where GetDistance(&quot;10.1357002, 49.9225563, 0&quot;, (select concat_ws(&#039;, &#039;, Longitude, Latitude, &#039;0&#039;) from zip)) &lt;= 40;
ERROR 1242 (21000): Subquery returns more than 1 row</description>
		<content:encoded><![CDATA[<p>Imran,</p>
<p>I am trying to use a non-scalar value for the value of &#8220;coordinates&#8221; in your example above, and it is not working.  How do you use the function in a query of a table where &#8220;coordinates&#8221; is a non-scalar query?  My query is below:</p>
<p>mysql&gt; select ZipCode from zip where GetDistance(&#8220;10.1357002, 49.9225563, 0&#8243;, (select concat_ws(&#8216;, &#8216;, Longitude, Latitude, &#8216;0&#8242;) from zip)) &lt;= 40;<br />
ERROR 1242 (21000): Subquery returns more than 1 row</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: review</title>
		<link>http://www.imranulhoque.com/mysql/mysql-function-to-find-distance-between-two-places-using-latlong/comment-page-1/#comment-5667</link>
		<dc:creator>review</dc:creator>
		<pubDate>Wed, 30 Nov 2011 22:19:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.imranulhoque.com/?p=89#comment-5667</guid>
		<description>&lt;strong&gt;review...&lt;/strong&gt;

[...]Mysql function to find distance between two places using lat/long &#171; imranul hoque&#039;s blog[...]...</description>
		<content:encoded><![CDATA[<p><strong>review&#8230;</strong></p>
<p>[...]Mysql function to find distance between two places using lat/long &laquo; imranul hoque&#39;s blog[...]&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://www.imranulhoque.com/mysql/mysql-function-to-find-distance-between-two-places-using-latlong/comment-page-1/#comment-5635</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Tue, 24 May 2011 13:52:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.imranulhoque.com/?p=89#comment-5635</guid>
		<description>Imran, I tried your function and tested it against a couple of online tools and found that if I run the function on 2 points (&quot;33.745,-84.389,0&quot;, &quot;34.037,-84.576,0&quot;) I get 13.06459190 miles.  Which is off by about 10 miles based on other online tools (including gmaps).  However, when I pull out your query and run it outside of the function manually I get the correct distance: 22.8477833829375 miles.  Wandering what&#039;s up but more importantly I prefer running the sql rather than the function so thanks for posting this.</description>
		<content:encoded><![CDATA[<p>Imran, I tried your function and tested it against a couple of online tools and found that if I run the function on 2 points (&#8220;33.745,-84.389,0&#8243;, &#8220;34.037,-84.576,0&#8243;) I get 13.06459190 miles.  Which is off by about 10 miles based on other online tools (including gmaps).  However, when I pull out your query and run it outside of the function manually I get the correct distance: 22.8477833829375 miles.  Wandering what&#8217;s up but more importantly I prefer running the sql rather than the function so thanks for posting this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Imran</title>
		<link>http://www.imranulhoque.com/mysql/mysql-function-to-find-distance-between-two-places-using-latlong/comment-page-1/#comment-5603</link>
		<dc:creator>Imran</dc:creator>
		<pubDate>Wed, 23 Feb 2011 07:10:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.imranulhoque.com/?p=89#comment-5603</guid>
		<description>I have considered the lat/long as a varchar(120) field that contains lat/long as &quot;10.1357002, 49.9225563, 0&quot; format (the format google uses).</description>
		<content:encoded><![CDATA[<p>I have considered the lat/long as a varchar(120) field that contains lat/long as &#8220;10.1357002, 49.9225563, 0&#8243; format (the format google uses).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill</title>
		<link>http://www.imranulhoque.com/mysql/mysql-function-to-find-distance-between-two-places-using-latlong/comment-page-1/#comment-5602</link>
		<dc:creator>Bill</dc:creator>
		<pubDate>Wed, 23 Feb 2011 01:20:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.imranulhoque.com/?p=89#comment-5602</guid>
		<description>Imran, how are you storing the lat/long in `coordinates`?</description>
		<content:encoded><![CDATA[<p>Imran, how are you storing the lat/long in `coordinates`?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Imran</title>
		<link>http://www.imranulhoque.com/mysql/mysql-function-to-find-distance-between-two-places-using-latlong/comment-page-1/#comment-5585</link>
		<dc:creator>Imran</dc:creator>
		<pubDate>Mon, 10 Jan 2011 17:57:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.imranulhoque.com/?p=89#comment-5585</guid>
		<description>Thanks Paul for sharing. It will surely help others,</description>
		<content:encoded><![CDATA[<p>Thanks Paul for sharing. It will surely help others,</p>
]]></content:encoded>
	</item>
</channel>
</rss>

