Search code examples
oracle-databasejasper-reports

How to inject values of one dataset to another dataset in jasper


I have two data-sets having count of products from one table,and another data-set having sun(prices of product) from a different table.I have two separate data-sets for these two queries.Now I need to use the values of these two data-sets in the third row in my report as SUM/count.How do I inject those two fields into my third data-set?


Solution

  • I solved this using JOIN.I used join between two select statements.

    SELECT products.count,prices.sumofproducts FROM
    (select count(*) as count,1 as DUMMY from products) products
    join
    (select sum(prices) as sumofproducts,1 as DUMMY from prices) prices
    on products.DUMMY=prices.DUMMY