这段代码在没有错误或警告的情况下,硬编码点时选择表中的所有行:
然而,当我使用名为“location”的列来定义点时,没有选择任何行(没有错误或警告):
SELECT *
FROM lat_lng
WHERE Contains(
GeomFromText('POLYGON((0 0,0 100,100 100,100 0,0 0))'),
GeomFromText('Point(50 50)') )
或者通过变量$var = "50 50"来定义(无错误或警告)
SELECT *
FROM lat_lng
WHERE Contains(
GeomFromText('POLYGON((0 0,0 100,100 100,100 0,0 0))'),
GeomFromText('Point($var)') )
然而,当我使用名为“location”的列来定义点时,没有选择任何行(没有错误或警告):
SELECT *
FROM lat_lng
WHERE Contains(
GeomFromText('POLYGON((0 0,0 100,100 100,100 0,0 0))'),
GeomFromText('Point(location)') )
基于这个双行样本表格:
id | location
1 | 50 50
2 | 500 500
为什么?