1SELECT StatusLookup.[StatusName],
2COUNT(Delivery.DeliveryID) AS Dispatched_Status
3FROM Delivery
4JOIN StatusLookup ON Delivery.Status = StatusLookup.StatusID
5WHERE StatusLookup.[StatusName] = 'Dispatched'
6GROUP BY StatusLookup.[StatusName];
7
1CREATE TABLE [dbo].[StatusLookup](
2 [StatusID] [int] NOT NULL,
3 [StatusName] [varchar](64) NOT NULL,
4 [StatusDescription] [varchar](max),
5)
6
7INSERT INTO [dbo].[StatusLookup]([StatusID],[StatusName],[StatusDescription]
8VALUES(1, 'Dispatched', 'A dispatched record')
9...
10