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 |
|
jwallz
Starting Member
14 Posts |
Posted - 2009-02-20 : 18:36:12
|
| i have a table, 'articleViews' with columnsid, articleID, MemberID, viewDateI need to get a total count of members who have viewed at least 2 distinct articles. Can anyone help? I've been on this for 2 hours.It would be greatly appreciated. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-02-21 : 01:58:13
|
quote: Originally posted by jwallz i have a table, 'articleViews' with columnsid, articleID, MemberID, viewDateI need to get a total count of members who have viewed at least 2 distinct articles. Can anyone help? I've been on this for 2 hours.It would be greatly appreciated.
SELECT COUNT(MemberID)FROM(SELECT MemberIDFROM articleViewsGROUP BY MemberIDHAVING COUNT(DISTINCT articleID)>=2)t |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
jwallz
Starting Member
14 Posts |
Posted - 2009-02-21 : 12:20:02
|
| thanks to both of you. I used the query from Visakh16. I needed the distinct. Seemed to be more accurate. I appreciate it. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-02-22 : 01:05:41
|
welcome |
 |
|
|
|
|
|
|
|