0

following, pre condition.

Table is called point, columns are id start_long start_lat des_lat des_long

Select 
  * 
from 
  point 
WHERE 
  SQRT((71,5x(`start_long`-`des_long`))x(71,5x(`start_long`-`des_long`))+(111,3x(`start_lat`-`des_lat`))x(111,3x(`start_lat`-`des_lat`)))<=10.0

I am receiving a #1241 - Operand should contain 1 column(s) error. What is wrong?

I want to easily get the results where the square root (this is the correct function for distance between two points) is less than 10 km.

x stands for the multiplication stars

Thanks

jmilloy
  • 7,875
  • 11
  • 53
  • 86
Fabian K
  • 71
  • 7

2 Answers2

1

You have commas inside your SQRT function, causing your operand to have multiple columns.

user1936123
  • 216
  • 2
  • 11
  • 1
    And apparently you cannot configure mysql to accept commas as the decimal separator http://stackoverflow.com/questions/8669212/change-decimal-separator-in-mysql – jmilloy Mar 18 '13 at 17:27
  • That was the simple answer. ;-) Thanks – Fabian K Mar 18 '13 at 17:35
1

You are using commas for some numbers 71,5 and points in others 10.0

I suspect you're intending to use periods . for your decimals, and the commas are being interpreted as separate arguments.

pjama
  • 3,014
  • 3
  • 26
  • 27