hi all,
i had a request about creating a grid type report which will show the result of several calculation of my db fields in .NET section and a good suggestion was to use sql for this. So sql will make all calculations and i ll show the results in a grid. The problem is i dont have much experience on this and need some guidance.
Here is what i m trying to accomplish:
i have a table with say 5 columns. each column keeps 0 or 1 or <null>. the last column is the date column.
user will select a start and end date and i will find the sum off all 1's that are in the interval for each column and group them by month. And the result will be the source of my grid.
here is a sample db schema:
col1 col2 col3 col4 coldate
----- ---- ---- ---- -------
<null> 1 1 1 1/2/2005
0 0 <null> 1 1/7/2005
1 1 <null> <null> 3/1/2005
if user selects 1/1/2005 as his start date and 3/2/2005 as his end date here is what i want him to see:
month totalcol1 totalcol2 totalcol3 totalcol4
----- --------- --------- --------- ---------
jan 05 0 1 1 2
feb 05 0 0 0 0
mar 05 1 1 0 0
this will show in my grid so i have to give grid such structure.
How can i make the calculations on sql side and create such structure for the grid?
thank you
-shane
i had a request about creating a grid type report which will show the result of several calculation of my db fields in .NET section and a good suggestion was to use sql for this. So sql will make all calculations and i ll show the results in a grid. The problem is i dont have much experience on this and need some guidance.
Here is what i m trying to accomplish:
i have a table with say 5 columns. each column keeps 0 or 1 or <null>. the last column is the date column.
user will select a start and end date and i will find the sum off all 1's that are in the interval for each column and group them by month. And the result will be the source of my grid.
here is a sample db schema:
col1 col2 col3 col4 coldate
----- ---- ---- ---- -------
<null> 1 1 1 1/2/2005
0 0 <null> 1 1/7/2005
1 1 <null> <null> 3/1/2005
if user selects 1/1/2005 as his start date and 3/2/2005 as his end date here is what i want him to see:
month totalcol1 totalcol2 totalcol3 totalcol4
----- --------- --------- --------- ---------
jan 05 0 1 1 2
feb 05 0 0 0 0
mar 05 1 1 0 0
this will show in my grid so i have to give grid such structure.
How can i make the calculations on sql side and create such structure for the grid?
thank you
-shane