>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