I work with SQL Server 2008. Now I need in help for solving such task: Return the number of distinct locations that are either employee or customer locations in each country. I have table Employees (empid, country,region,city) and table Customers(custid,
country,region,city).
I have a query like that:
SELECT country, region+city FROM
(SELECT country, region, city FROM [TestSQL].[HR].[Employees]
UNION SELECT country, region, city FROM [TestSQL].[Sales].[Customers]) X
GROUP BY Country ORDER BY Country
On the place region+city I need to calculate any way the quantity of different locations employees and customers.
output:
country numlocations
--------------- ------------
View Complete Post