mikij Posted November 13, 2008 Share Posted November 13, 2008 Hi, I need to define a report that have predefined multiple ranges for rows. I have simple table Orders, and I need to define report like this, e.g. for a year: ------------------------------------------------------------------------------ Order price | Value | Percent | ----------------------------------------------------------------------------- 0-1000 | someValue$ | % (of all values) | ----------------------------------------------------------------------------- 1000-2000 | someValue$ | % (of all values) | ----------------------------------------------------------------------------- etc., to 9000-10000. |----------------------------------------------------------------------------- I tried to do this with select CASE WHEN (price > 0 and price < 1000) then '0-1000' END as price ...group by price, but in such case I cannot see those ranges (rows) where I don't have value, and for these rows value and percent should be 0 in Value and Percent columns. Do you have ANY HINT how can I define report like this in JasperReports (iReport), because I don't have :-( ? --Thx in advance!! Link to comment Share on other sites More sharing options...
mikij Posted November 14, 2008 Author Share Posted November 14, 2008 I defined 12 queries like this, for every range: SELECT '0-1000' as Order price, sum(Value) from Order... where price >= 0 and price <=1000union allSELECT '1000-2000' as Order price, sum(Value) from Order... where price >= 2000 and price <=1000union all...but I don't like this solution, because in this case I need to have 12 such queries, and I'm afraid that it's too much. Anyone have maybe some better solution ? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now