postgresql聚合函数内部循环

时间:2017-01-06 17:37:44

标签: postgresql loops for-loop aggregate-functions

我正在尝试创建此功能,但我收到此错误: 错误:“max”不是已知变量

但是,如果我使用其中一个聚合函数可以正常工作,但不能同时使用这两个函数

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8"> <!-- utf-8 works for most cases -->
    <meta name="viewport" content="width=device-width"> <!-- Forcing initial-scale shouldn't be necessary -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge"> <!-- Use the latest (edge) version of IE rendering engine -->
    <meta name="x-apple-disable-message-reformatting">  <!-- Disable auto-scale in iOS 10 Mail entirely -->
</head>

1 个答案:

答案 0 :(得分:0)

如果您有多列,则仍然只有一个into

        SELECT MIN(fatura.inicio), MAX(fatura.inicio) 
            into inicio, fim --<< here
        FROM fatura
        WHERE lote = rResult.lote;