-- SQL_GetJobSummary declare @jobId varchar(20), @totalTrays int, @goodTrays int, @badTrays int, @reviewTrays int, @traysToScan int set @jobId = '{0}' select @totalTrays = count(*) from [Green Circle Growers$Container Entry] (nolock) where [Container Type] = 1 and [Job No_]=@jobId select @goodTrays = count(*) from [Green Circle Growers$Container Entry] (nolock) where [Container Type] = 1 and [Job No_]=@jobId and [Fixing Status]=1 select @badTrays = count(*) from [Green Circle Growers$Container Entry] (nolock) where [Container Type] = 1 and [Job No_]=@jobId and [Fixing Status]=2 select @reviewTrays = count(*) from [Green Circle Growers$Container Entry] (nolock) where [Container Type] = 1 and [Job No_]=@jobId and [Fixing Status]=3 select @traysToScan = count(*) from [Green Circle Growers$Container Entry] (nolock) where [Container Type] = 1 and [Job No_]=@jobId and [Fixing Status] Not in (1,2,3) select @totalTrays [TotalTrays] , @goodTrays [GoodTrays] , @badTrays [BadTrays] , @reviewTrays [ReviewTrays] , @traysToScan [TraysToScan]