Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
SQLNoob81
Starting Member
38 Posts |
Posted - 2012-11-02 : 06:36:44
|
| Hi AllI have a clients table and an orders table. I need to find clients with orders in more than one [Country] in the orders table.I then need to count the order for clients who have orders in more than one country.Your help is appreciated. |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2012-11-02 : 06:47:52
|
You can do both in one query:SELECT clientId, COUNT(Orders) AS OrderCountFROM OrdersTableGROUP BY clientIdHAVING COUNT(DISTINCT country) > 1; |
 |
|
|
|
|
|