Обсуждение: [SQL] Geometric, getting x and y co-ordinates from point data type/

Поиск
Список
Период
Сортировка

[SQL] Geometric, getting x and y co-ordinates from point data type/

От
Stuart Rison
Дата:
Hi there,

Suppose you have a table:

id     pos
1    (0,5)
2    (-1,6)
3    (5.5,9.8)

Are there functions to get to the individual coords such that

SELECT id,x_coord(pos),y_coord(pos) FROM table;

gives

id    x_coord    y_coord
1    0    5
2    -1    6
3    5.5    9.8

Stuart.



+-------------------------+--------------------------------------+
| Stuart Rison            | Ludwig Institute for Cancer Research |
+-------------------------+ 91 Riding House Street               |
| Tel. (0171) 878 4041    | London, W1P 8BT, UNITED KINGDOM.     |
| Fax. (0171) 878 4040    | stuart@ludwig.ucl.ac.uk              |
+-------------------------+--------------------------------------+