ERROR: more than one row returned by a subquery used as an expression
ERROR: more than one row returned by a subquery used as an expression
我正在开发一个 asp.net 数据,我会在一列中插入一个数据。我在 postgresql 中使用这段代码,它说但是它给了我这个错误。你能帮帮我吗?
错误:用作表达式的子查询返回多行 SQL 状态:21000
SELECT ST_Line_Interpolate_Point (route.geom,(select (pk_accident)/(pk_fin-pk_debut) from route, accident_ma
where route.num_route = accident_ma.num_route order by route.num_route))
from route,accident_ma where route.num_route = accident_ma.num_route order by route.num_route;
ST_Line_Interpolate_Point 是标量函数,它被设计为作为两个值的输入集。
在-select-查询"SELECT (pk_accident)/(pk_fin-pk_debut)
从路线,accident_ma
其中 route.num_route = accident_ma.num_route
订购方式 route.num_route "
假设 return 每个 selected 记录一个值(这个值将被 ST_Line_Interpolate_Point 函数使用),但是在-select-查询中 return不止一条记录.
在 Oracle 中,您可以通过添加额外的过滤器来修改查询
"And rownum=1" 过滤器,对于 none oracle 案例,您可以添加 限制1过滤器
select (pk_accident)/(pk_fin-pk_debut)
从路线,accident_ma
其中 route.num_route = accident_ma.num_route
极限 1
这应该可以解决问题
我正在开发一个 asp.net 数据,我会在一列中插入一个数据。我在 postgresql 中使用这段代码,它说但是它给了我这个错误。你能帮帮我吗?
错误:用作表达式的子查询返回多行 SQL 状态:21000
SELECT ST_Line_Interpolate_Point (route.geom,(select (pk_accident)/(pk_fin-pk_debut) from route, accident_ma
where route.num_route = accident_ma.num_route order by route.num_route))
from route,accident_ma where route.num_route = accident_ma.num_route order by route.num_route;
ST_Line_Interpolate_Point 是标量函数,它被设计为作为两个值的输入集。
在-select-查询"SELECT (pk_accident)/(pk_fin-pk_debut) 从路线,accident_ma 其中 route.num_route = accident_ma.num_route 订购方式 route.num_route "
假设 return 每个 selected 记录一个值(这个值将被 ST_Line_Interpolate_Point 函数使用),但是在-select-查询中 return不止一条记录.
在 Oracle 中,您可以通过添加额外的过滤器来修改查询
"And rownum=1" 过滤器,对于 none oracle 案例,您可以添加 限制1过滤器
select (pk_accident)/(pk_fin-pk_debut) 从路线,accident_ma 其中 route.num_route = accident_ma.num_route 极限 1
这应该可以解决问题