我正在尝试在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
我的查询中是否有任何问题导致其像这样更改?该语法在其他查询分析器中效果很好。
您的查询应该是有效的,但是Pentaho似乎在解析它时遇到了问题。
您可以尝试使用
SELECT SUM(loan_receivable_detail.interest) AS interest, loan_account_opening_id FROM loan_receivable_detail GROUP BY loan_account_opening_id
它提供与您的查询相同的结果,但没有子查询(希望它将使Pentaho满意)