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 |
|
acdacd
Yak Posting Veteran
63 Posts |
Posted - 2005-08-15 : 03:59:33
|
| select count(*), colA from tableAErrorColumn 'Jobs.JobID' is invalid in the select list because it is not contained in an aggregate function and there is no GROUP BY clause.What is the problem?be a hardworking people!! |
|
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2005-08-15 : 04:33:49
|
| Try this Select Count(*),ColA From TableA Group By ColAComplicated things can be done by simple thinking |
 |
|
|
mwjdavidson
Aged Yak Warrior
735 Posts |
Posted - 2005-08-15 : 04:36:30
|
| HiWhat resultset are you expecting? Count() is an aggregate function that returns a single value representing the count of all rows in a table including duplicates and nulls (when used with the '*').colA must either be removed, added to a group by clause (to give the count for each value), or wrapped in an aggregate function.Mark |
 |
|
|
acdacd
Yak Posting Veteran
63 Posts |
Posted - 2005-08-15 : 05:17:31
|
| My orginal expected Result set.Result[Count ColA] 3 ab 3 cd 3 dyI dont know what is aggreate fun before.If I want to get the result above. How to construct the query?Also, "wrapped in an aggregate function". What does it mean?Thx for all answers!be a hardworking people!! |
 |
|
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2005-08-15 : 05:23:53
|
| hi Did u tried this query .. i suppose this should work for you.. Select Count(*),ColA From TableA Group By ColAThe Function llike Count,Sum,Avg etc are called as an aggregate Function.. this type of functions are used to generate the summary based query which i think you want.. that the count of the records in the colA are there...you Can Search on Bol For Aggregate function.. this will give the better view.. of the Aggregate Fun :-)Complicated things can be done by simple thinking |
 |
|
|
acdacd
Yak Posting Veteran
63 Posts |
Posted - 2005-08-15 : 05:56:51
|
| I see.Thank you very muchbe a hardworking people!! |
 |
|
|
|
|
|