Stored Procedure for dashboard

  • 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 -New100100100

    Count of Overdue -Pending200200200

    Count of Today's-New200200200

    Count of Today's-Pending300300300

    Total800 800 800

    How can i write stored proc to get values in the above manner? Please help

  • 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/

  • 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.

  • 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..

  • 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.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply