我正在尝试调用存储过程在左外连接中传递参数,如下所示:
select i.name,sp.*
from items i
left join compute_prices(i.id,current_date) as sp(price numeric(15,2),
discount numeric(5,2), taxes numeric(5,2)) on 1=1
where i.type = 404;
Run Code Online (Sandbox Code Playgroud)
compute_prices()返回一组记录.
这是postgres显示的消息:
错误:对表"i"的FROM子句条目的无效引用
...左连接compute_prices(i.id,current_date)...
提示:表"i"有一个条目,但不能从查询的这一部分引用它.
这种查询适用于Firebird.有没有办法可以通过使用查询使其工作?我不想创建另一个循环遍历项目并进行单独调用的存储过程compute_prices().