Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Stored Procedure for dashboard Expand / Collapse
Author
Message
Posted Monday, January 21, 2013 10:42 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, May 28, 2014 5:17 AM
Points: 31, Visits: 105
hi,

i have three tables A,B,C in which i have datecreated column and status column in all three tables.
Status will be like 'New','Pending' etc.....
I need to show data in the dashboard like

A B C
Count of Overdue -New 100 100 100
Count of Overdue -Pending 200 200 200
Count of Today's-New 200 200 200
Count of Today's-Pending 300 300 300
Total 800 800 800
How can i write stored proc to get values in the above manner? Please help
Post #1409648
Posted Monday, January 21, 2013 11:38 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Sunday, December 14, 2014 11:09 PM
Points: 1,962, Visits: 2,406
Can you please provide us the table structure so that we can try to solve your problem?

Its good practice to provide detailed information so that everyone can understand problem that your are facing.....



_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Post #1409660
Posted Monday, January 21, 2013 2:39 PM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Wednesday, December 10, 2014 7:32 AM
Points: 477, Visits: 3,680
The "easiest to understand" type of solution is to build a temp table exactly like you want the output to look. Then have individual queries gather the pieces of information and update the temp table as you go along. All of these queries can be wrapped as one in a stored procedure. It's not hard, you just have to break it down into manageable chunks. What have you tried so far?



______________________________________________________________________________
How I want a drink, alcoholic of course, after the heavy lectures involving quantum mechanics.
Post #1409717
Posted Tuesday, January 22, 2013 2:21 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, May 28, 2014 5:17 AM
Points: 31, Visits: 105
Table structure:

create table A
id1 int,
status int
date created datetime

table B
id2 int
status int
date created datetime

table c
id3 int
status int
date created datetime

table status
id
description


The description field will be like pending, new etc...

i need the output as mentioned above..
Post #1409870
Posted Tuesday, January 22, 2013 6:59 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Wednesday, December 10, 2014 7:32 AM
Points: 477, Visits: 3,680
smriti.subramanian (1/22/2013)
Table structure:

create table A
id1 int,
status int
date created datetime

...


I tried running this in SSMS and it didn't parse. If only we had some valid DDL. Oh well...


______________________________________________________________________________
How I want a drink, alcoholic of course, after the heavy lectures involving quantum mechanics.
Post #1410012
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse