ANonmous Change
ANonmous Change

Reputation: 808

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...

Upvotes: 2

Views: 1092

Answers (1)

Petr Chudanic
Petr Chudanic

Reputation: 547

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 )

Upvotes: 1

Related Questions