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 |
|
BaggaDonuts
Yak Posting Veteran
52 Posts |
Posted - 2011-03-10 : 00:14:51
|
| Say I have a table:UserActivityUserId intVersion intActivityDate smalldatetimeSomeData varchar(max)This table has no constraintsI want to get the total UNIQUE users per version. i tried the following query:select Version, count(UserId)from UserActivitygroup by Versionbut that gives me the total number of users per version not the total number of unique users. can someone help me out? |
|
|
MIK_2008
Master Smack Fu Yak Hacker
1054 Posts |
Posted - 2011-03-10 : 00:31:10
|
| Use thisselect Version, count(Distinct UserId)from UserActivitygroup by VersionCheersMIK |
 |
|
|
BaggaDonuts
Yak Posting Veteran
52 Posts |
Posted - 2011-03-10 : 01:41:50
|
| Nice that worked. thanks |
 |
|
|
MIK_2008
Master Smack Fu Yak Hacker
1054 Posts |
Posted - 2011-03-10 : 01:50:31
|
WElcome CheersMIK |
 |
|
|
|
|
|