2

我正在尝试在 Pentaho Report Designer 中创建我的第一个报告。我创建了一个 JDBC 数据源并添加了一个查询:

SELECT a.* 
FROM   (SELECT Sum(loan_receivable_detail.interest) AS interest, 
               loan_account_opening_id 
        FROM   loan_receivable_detail 
        GROUP  BY loan_account_opening_id) AS a 

但是,当我保存查询时,它会更改为:

SELECT
     a.*,
     sum(loan_receivable_detail.interest) AS interest,
     loan_account_opening_id AS interest
FROM
     `loan_receivable_detail`
GROUP BY
     loan_account_opening_id,
     as,
     a

我的查询中是否有任何问题导致它像这样改变?该语法在其他查询分析器中运行良好......

4

1 回答 1

1

您的查询应该是有效的,但 Pentaho 似乎在解析它时遇到了问题。

你可以尝试使用

SELECT SUM(loan_receivable_detail.interest) AS interest, 
               loan_account_opening_id 
        FROM   loan_receivable_detail 
        GROUP  BY loan_account_opening_id

它给出了与您的查询相同的结果,但没有子查询(希望它会让 Pentaho 高兴)

于 2014-01-03T12:07:56.543 回答