我尝试使用协调创建一个SQL数据库,如下所示:
CREATE TABLE automaten_loc(
id INT NOT NULL AUTO_INCREMENT,
location POINT NOT NULL,
primary key(ID) );
我插入了一些数据:
INSERT INTO automaten_loc (location)
VALUES (POINT(12.34567, 76.54321));
但是选择*会返回:
我对SQL不太好,我不知道出了什么问题......
你知道为什么吗? 谢谢:))答案 0 :(得分:1)
SELECT ID, CONCAT(ST_X(location),',',ST_Y(location)) as loc FROM automaten_loc
答案 1 :(得分:1)
尝试此操作以获取x cordinate和y conrdinate
SELECT x(location),y(location) FROM test.automaten_loc;
mysql> SELECT x(location),y(location) FROM test.automaten_loc;
+-------------+-------------+
| x(location) | y(location) |
+-------------+-------------+
| 12.34567 | 76.54321 |
+-------------+-------------+
mysql> SELECT x(location),y(location),concat(x(location),', ',y(location)) FROM test.automaten_loc;
+-------------+-------------+---------------------------------+
| x(location) | y(location) | concat(x(location),y(location)) |
+-------------+-------------+---------------------------------+
| 12.34567 | 76.54321 | 12.34567, 76.54321 |
+-------------+-------------+---------------------------------+
1 row in set (0.03 sec)
我在我的系统执行此操作