I am trying to do a count of invoices by country within region. Below is a view of my table structure and required output. I have tried to do a basic view (not looking at CustomerArea yet as I want to get the basics right first) of this but cannot get into a nested mode.
SELECT Customerregion, COUNT(InvoiceNo ) AS CountCol1
FROM [Data-Warehouse].[dbo].[Master]
WHERE Customerregion='Europe'
GROUP BY Customerregion, InvoiceNo
Below is a view of the output for Europe only based on the above?
CustomerArea CustomerRegion InvoiceNo
Romania Europe INV001
Romania Europe INV002
Netherlands Europe INV003
Netherlands Europe INV003
Netherlands Europe INV003
Netherlands Europe INV004
Italy Europe INV005
Italy Europe INV005



InvoiceNoas well?customerregionif you restrict you result to one singlecustomerregionGROUP BY Customerregionshould do it.