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 |
|
IceDread
Yak Posting Veteran
66 Posts |
Posted - 2007-10-26 : 09:33:34
|
| I've a nub question that someone probably has the fast answere too.How do I count the number a columnvalue in a table has changed? I was starting to write a stupied cursor but there has to be a much smarter way.I've a case where I need to count the number of times the salary in a table for individual employees changes.Thanks in advance! |
|
|
IceDread
Yak Posting Veteran
66 Posts |
Posted - 2007-10-26 : 10:18:00
|
| That was simple.. and how could I forget my preasious books online or not just figure it out anyway.. must be because it's friday! Yeap that must deffinately be it.select count(distinct [columnname])is the solution for anyone else wondering. |
 |
|
|
KenW
Constraint Violating Yak Guru
391 Posts |
Posted - 2007-10-29 : 14:32:44
|
IceDread,All that does is count the number of distinct values in the <columnname> column.This is probably more along the lines of what you're looking for:SELECT EmployeeID, Count(EmployeeID) FROM Employees GROUP BY EmployeeID |
 |
|
|
|
|
|