简体   繁体   中英

Pentaho Report Designer error in query

I am trying to create my first report in Pentaho Report Designer. I have created a JDBC Data Source and added a query:

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 

However when I save the query, it changes to:

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

Is there any problem in my query causing it to change like this? The syntax works well in other query analyzers...

Your query should be valid, but it seems like Pentaho is having problems parsing it.

You could try to use

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

Which gives the same results as your query but without the subquery (Hopefully it will make Pentaho happy )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM