Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting stats on repartition
Message
 
 
To
11/01/2011 16:36:57
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01495766
Message ID:
01495772
Views:
34
This message has been marked as a message which has helped to the initial question of the thread.
>I have a small report I need to make which consists of a status and a destination. Basically, I have a status table with 5 status. I have a destination with two destinations. Then, I have the export table which includes a reference to a status and to a destination. I need to obtain a repartition table which will lay out something like this:
>
>
>Destination           Pending              Retry
>My destination 1         12                  4
>My destination 2         13                  2
>
>
>So, the goal is to obtain that in one SQL and also include all status even if there are zero count in it.

If you need a report with all statuses for each destination, then first you need to do a cross join between statuses and destinations and the LEFT JOIN with the rest of your query (derived table).

If you post relevant DDL and some insert statements and desired output, I'll post a query for you.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform