Click here to Skip to main content
15,890,440 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a table which has following fields.

1.id
2.title
3.fileno
4.date_recieving
5.current_status

in current_status four values are saved open,closed,pending and inprogress.
i want to make monthly report in rdlc.

where i have a drop down from which user select year from dropdown list.e.g user select 2012.now i want report like this.mean how many files in month january are open,closed,pending and in progress.

Open Closed Pending InProgress Total
Jan 2 0 5 6
Feb 4 2 1 7
March
.
.
Dec

kindly help me,and tell me the query for report like this.
thanks in advance.
Posted

Hi,

You can get total no of files based on status using following query :

SELECT
SUM( case current_status when 'Open' then 1 else 0 end ) as 'Open',
SUM( case current_status when 'Closed' then 1 else 0 end ) as 'Closed',
SUM( case current_status when 'Pending' then 1 else 0 end ) as 'Pending',
SUM( case current_status when 'InProgress' then 1 else 0 end ) as 'InProgress',
SUM(1) as 'Total'
FROM #TEMP1


Just add logic of group by month into that.
 
Share this answer
 
Comments
bilawal121 22-Feb-12 1:08am    
Thanks for your reply and it works for me but now how i show this on my report design??
i name each colum of report design open,close,pending and inprogress and in field column i write experession that give me error,
i write this expression
=Fields!CURRENT_STATUS.Value="Open"
=Fields!CURRENT_STATUS.Value="Closed"
=Fields!CURRENT_STATUS.Value="Pending"
=Fields!CURRENT_STATUS.Value="inprogress"
select sum(current_status)
from table
group by current_status
having month(date_recieving)='1'
 
Share this answer
 
Hi,

SQL
SELECT *
FROM
(
SELECT     datename(month,date_recieving) As [Month], current_status, ID
FROM         files
) t 
PIVOT 
(
COUNT(ID) FOR current_status  IN ([Pending],[Closed])
) as pvt
 
Share this answer
 
i have solved this problem by getting current status through above query and then just drag fields from store procedure thanks for all.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900