Web application contains two pages
1.index.jsp
2.result.jsp
index page contains input values such as weeknum,sla etc , user has to fill the input values , after that query will be executed in result page
This is my database table
weeknum groupby images actct sla24 sla8 CTSUM type
1 studio 123 8.5 5 11 16 16 short
1 studio 12 9.5 6 12 16 12 long
1 studio 154 10.5 7 13 16 short
2 studio 123 11.5 8 14 16 long
2 studio 12 12.5 9 15 16 short
2 studio 154 13.5 10 16 16 long
And below is jsp page database query (resultPage)
"<sql:query var=""retouch"" dataSource=""jdbc/imaging"">
SELECT WEEKNUM,
GROUPBY,
SUM(IMAGES) AS IMAGES,
SUM(SLA24) AS SLA24,
ROUND(SUM(CTSUM)/SUM(IMAGES),2) AS AVGCT,
ROUND(SUM(SLA24)/SUM(IMAGES)*100,2) AS CTPERC
FROM (SELECT
WEEKNUM,
COLUMNTYPE as groupby,
IMAGES,
ActCT,
IMAGES * AVGCT AS CTSUM,
SLA24,SLA8
FROM RETOUCHSUMMARY
WHERE WEEKNUM = ?
<sql:param value=""${param.weeknum}"" /> )AS CT GROUP BY
WEEKNUM,COLUMNTYPE;
</sql:query>"
The above query works fine,by default it picks sla24 column.
it is possible , if user selects sla8 in index page query has to pick sla8 column inside of sla24 ..?
Hope i explained well, Please help
Related
I am stuck into a problem....
I am filling my Table with Dataset with FIXED rows but Dynamic Columns.
My Requirement is that I need to have a page break after 5 columns...
Eg:
Product Name 2003 2004 2005 2006 2007
Mobile 10 15 20 19 17
Laptop 55 2 3 17 10
Tablet 10 10 25 4 9
Similarly on next page , I should have
Product Name 2008 2009 2010 2011 2012
Mobile 50 5 2 19 25
Laptop 5 2 30 17 100
Tablet 10 10 25 4 19
I haven't got anyone's reply till now ... :-(
But my problem is solved :
I followed this link : http://blogs.msdn.com/b/chrishays/archive/2004/07/23/horizontaltables.aspx
Above link also hade the HorizontalTable.rdl attached...
I just adjusted my fields,Dataset and groupnames... It is working like charm...!!!!
Thanks Chris..!!!
Regards,
You could create secondary data source and use it to filter the main one - with one record per "page". So, you would create "wrapper" report where you push all the data, add table to it with single column where you would drop subreport where you only push data filtered by the values in the record of the secondary "wrapper" table.
I've got an issue where I've been presented data in this format from SQL, and have directly imported that into SSRS 2008.
I do have access to the stored procedure for this report, however I don't want to change it as a few other reports rely on it.
Project HoursSpent Cost
1 5 45
1 8 10
1 7 25
1 5 25
2 1 15
2 3 10
2 5 15
2 6 10
3 6 10
3 4 5
3 4 10
3 2 5
I've been struggling all morning to understand how/when I should be implementing the SUM() function with this.
I have tried already to SUM() the rows, but it still outputs the above result.
Should I be adding any extra groups?
Ideally, I need to have the following output:
Project HoursSpent Cost
1 25 105
2 15 40
3 16 30
EDIT: Here is my current structure:
"LineName" is a group for each project
You have to add a row group on "Project" since you want to sum up the data per each project.
OK this is the data I am working with:
category_child_id category_parent_id
1 0
2 0
3 1
4 1
5 3
6 3
7 4
8 0
9 8
10 8
11 0
12 11
13 11
14 0
15 14
16 14
17 14
18 0
19 18
20 18
21 18
0 19
It's basically categories with sub categories etc etc.
If I
SELECT category_child_id FROM category_xref WHERE category_parent_id = 1
it returns 3 & 4 which is correct. However there are no products in this category only in the category below so the results I actually want are 5 & 6 as well. However this is not always the same so it does need to be a query.
So basically I need to run a query to get all connected(nested) categories from the table. I've tried many ways with failed results so any help would be great.
If you are using PostgreSQL you could have used "WITH RECURSIVE" but MySQL does not support dynamic, recursive queries. You have to do it with your accessing language (e.g. PHP, Java).
There you can iterate over your recordset and perform a query for each returned child row until no more child rows are returned.
As TRD says, there are extensions to SQL supporting recursive searching of self-joins (Oracle uses 'CONNECT BY') however not only are these not available in MySQL, they're also not the most efficient nor flexible solution.
Have a google for adjacency list model - I did and found this.
I am creating a SSRS 2008 Report
in my report i have 200 columns, it is difficult for visualizing purpose,
is there any way in SSRS by which i can show 20 column per page with row hearer in each page.
ex..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 .....................
2010 5 4 8 7 6
2011 9 7 5 8 9 4 2 5
2012 1 2 4 5 3
2013
can i break to show only 20 columns in first page & reamin 20 second page & show on with column heaer repeat in each page
Thankyou
Assuming that your column IDs are sequential, simply set up a new column grouping as =Floor(Fields!columnID.Value/20) above your existing column ID grouping and set a page break on your new grouping.
I have array and table that I referenced some elements in array. Like my array
1 2 3 4 5 6
7 8 9 10 11 12
13 14 15 16 17 18
19 20 21 22 23 24
And I have area like Start point s=9,X=2,Y=2,Row Count R=6
then I have boxes 9,10,11,15,16,17,21,22,23
Now I am trying to write some sql that check if 16 number in this area.I created some logic like if ((s<16<s+X) || (s+6<16<s+x+6) || (s+12<16<s+x+12) ) but should I write it in one sql query? I am using mySql.
This doesn't have anything to do with SQL, I don't think, but something like the following condition is probably what you want. Since your example has the same value of X and Y, and "Row Count" sounds more like "number of rows" than "number of items in a row," I may have gotten rows and columns backwards from what you want.
set #s=9, #x=2, #y=5, #R=6, #testval=16;
(#testval-1)/#R between (#s-1)/#R and (#s-1)/#R - #y - 1
and (#testval-1)%#R between (#s-1)%#R and (#s-1)%#R - #x - 1