Results 1 to 4 of 4
Nov 26, 2012, 11:12 #1
- Join Date
- Feb 2002
- Milwaukee, WI
- 0 Post(s)
- 0 Thread(s)
Help with getting users and unique comments per widget
Given the three tables:
id name 1 ABC Widget 2 XYZ Widget 3 123 Widget 4 789 Widget
id name 1 John Doe 2 Jane Doe 3 Mr. Rogers
widget_id user_id comment 1 1 testing 2 1 a test 2 2 hello! 3 1 sample text 4 2 woohoo 4 2 goodbye!
How could I compile a list of users and the number of widgets they, and only they, entered comments on. Example results:
users.name # widgets John Doe 2 Jane Doe 1
Based on the data, widget 1 has 1 comment (by John Doe only), widget 2 has 2 comments (by John Doe and Jane Doe), widget 3 has 1 comment (by Jane Doe), and widget 4 has two comments (by John Doe). Since widget 2 has comments by two different users, it wouldn't be counted in the results. The other widgets only have comments by one specific user, so they would be counted in the results. Also, since Mr. Rogers had no comments, he shouldn't show up in the list.
Any help with this?