I have 2 queries that are as follows:
SELECT COUNT(cvu.[ID]), 'Exp' AS [Exp]
FROM [dbo].[tblClientVehicleUnit] cvu
WHERE ExpirationDate < GetDate()
AND cvu.Id = '4C1'
And the second one:
SELECT COUNT(cvu.[ID]), 'NonExp' AS [Exp]
FROM [dbo].[tblClientVehicleUnit] cvu
WHERE ExpirationDate > GetDate()
AND cvu.Id = '4C1'
How would I divide the counts between these two? It will always only return 2 values and one will be called Exp and one will be called NonExp.
Thanks
Basically treat those two queries as sub queries as below.
If you wanted to take it further you could then have the cvu.id as part of the select and modify the join so you could do it across all cvu.id’s