0

As i ask before where col in() clause for geometry column in mysql

i have a lot of Point in my table and i want to find multiple points from my table by one query, someone suggest that use MBRWithin() or MBRContains() geospatial functions in MySQL, but i don't know how to use this functions with multiple points like this Where in() query :

SELECT id, asText(latlng) FROM points WHERE asText(latlng) in ('POINT(35.80684 51.427820000000004)','POINT(35.72343 51.303200000000004)')

can help me to select with multiple points?

thanks

Community
  • 1
  • 1
M2sh
  • 741
  • 1
  • 11
  • 23

1 Answers1

0

Well right now you're searching for the string "POINT(35.80684 51.427820000000004)" rather than the value of the function so for sure we want to change that.

In this case may be just easier to use individual conditions rather the the IN statement

SELECT 
  id
, asText(latlng) 
FROM points 
WHERE (   asText(latlng) = POINT(35.80684 51.427820000000004)
       OR asText(latlng) = POINT(35.72343 51.303200000000004)
       OR …
      )
asantaballa
  • 3,919
  • 1
  • 21
  • 22
  • OK, but for faster and better performance i need to use spatial index because sometimes when we have 200 points to find in table we will create a very long query with or statement. do you know about spatial indexes to help me? thanks. – M2sh Oct 25 '13 at 12:49
  • for better explanation you can see third answer in my older question in this link : [where-col-in-clause-for-geometry-column-in-mysql](http://stackoverflow.com/questions/19476098/where-col-in-clause-for-geometry-column-in-mysql). – M2sh Oct 25 '13 at 12:51