gpt4 book ai didi

函数内的 SQL 查询

转载 作者:太空狗 更新时间:2023-10-30 01:49:42 27 4
gpt4 key购买 nike

我正在将 PostgreSQL 与 PostGis 结合使用。我正在执行这样的查询:

select st_geomfromtext('point(22 232)',432)

它工作正常。但是现在我想通过查询取一个值。例如:

select st_geomfromtext('point((select x from data_name where id=1) 232)' , 432)

data_name 是我正在使用的一些表,x 存储了一些值。现在里面的查询被当作一个字符串,没有返回值。
请帮忙。

ERROR: syntax error at or near "select"

最佳答案

试试这个:

select st_geomfromtext('point(' || x || ' 232)', 432) from data_name where id=1

关于函数内的 SQL 查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15856076/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com