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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-04-18 : 07:12:57
|
| Chetan Kelkar writes "Hello,This might sound a little lowjack question to you guys, regret it.I have a table like this with some data in it.-------------------------------Sr. No. | Company | Locations |-------------------------------1. | Wipro | USA2. | Wipro | UK3. | Wipro | India4. | NMC | India5. | NMC | Australia6. | Infosys | USA7. | Infosys | UK8. | Infosys | Germany9. | NMC | Germany10. | Aztec Consultings | GermanyWhat I would like to find out is the company and the number of locations they are present where the number of locations is greater than one. For ex. the results retrieved should be like this -->------------------------------- Company | Number of Locations-------------------------------1. Wipro | 32. NMC | 33. Infosys | 3-------------------------------It shouldnt count the companies which are present only at one locations.Your help will be highly appreciated. Thanks in advance,Chetan Kelkar" |
|
|
LarsG
Constraint Violating Yak Guru
284 Posts |
Posted - 2005-04-18 : 07:31:31
|
| [code]select company,count(*)from tgroup by companyhaving count(*) > 1[/code] |
 |
|
|
|
|
|