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 |
|
trae
Starting Member
2 Posts |
Posted - 2011-06-05 : 17:18:10
|
| hello all new to the site trying to get some help with a script im trying to write. we have a database in which im pulling 4 colums from i can do that all fine with no troubles .for the count i need i can get the count of the TOTAL with no problems either. my issue is that i need to get those totals dependant on the data from one column.for instance use *my DB*select cu_xx,cu_xxx_cu_xxxx,cu_xxxxxfrom dbo.1where cu_xx = 'xx'that statement returns the bulk of what im after but in colum cu_xxxxx there are multiple entries per various company. i would like a statement that will return the number of rows for each company. hope that make sense? any ideas?i know a select count(cu_xxxxx) from dbo.1 would return it all but i need it broken down by company is that possible? |
|
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
Posted - 2011-06-05 : 17:59:08
|
| Select SomeColumn, count(*) from ATable Group By SomeColumn--Gail ShawSQL Server MVP |
 |
|
|
trae
Starting Member
2 Posts |
Posted - 2011-06-05 : 18:08:29
|
| damn it was that easy .. thanks Gila!! much appreciated |
 |
|
|
|
|
|