Well, I still haven't come up with a way to show you all users and all items.
But you *can* get a report on all itemid's for a single user.
I added some more data to my test table and then ran the query you will see below.
Code:
mysql> select itemid, userid, dateAdded from itemComments order by itemid, dateAdded;
+--------+--------+---------------------+
| itemid | userid | dateAdded |
+--------+--------+---------------------+
| 383 | ABC4EF | 2012-11-16 23:39:22 |
| 383 | 1 | 2012-12-08 09:46:41 |
| 383 | 100 | 2012-12-08 09:47:48 |
| 383 | ABC4EF | 2012-12-09 00:00:00 |
| 383 | 1 | 2012-12-10 00:00:00 |
| 383 | 33 | 2012-12-13 00:00:00 |
| 383 | 44 | 2012-12-13 00:00:00 |
| 777 | 1 | 2011-01-01 00:00:00 |
| 777 | ABC4EF | 2012-01-01 00:00:00 |
| 777 | 2 | 2013-01-01 00:00:00 |
+--------+--------+---------------------+
10 rows in set (0.00 sec)
mysql> select C.itemid, COUNT(*) FROM itemcomments AS C,
-> (SELECT itemid, Max(dateadded) AS lastcomment FROM itemcomments where userid = 'ABC4EF' group by itemid ) AS M
-> where C.itemid = M.itemid AND C.userid <> 'ABC4EF' AND C.dateadded > M.lastcomment
-> group by C.itemid;
+--------+----------+
| itemid | COUNT(*) |
+--------+----------+
| 383 | 3 |
| 777 | 1 |
+--------+----------+
2 rows in set (0.02 sec)
It's correct. For userid
ABC4EF there are indeed 3 comments after his last comment on itemid 383 but only 1 after his last comment on itemid 777.
Is this good enough? Or do you really need it for all userid's and all itemid's??