detailed activity log

0

Please login or register to vote for this query.

(click on this box to dismiss)

The Workplace Meta

Q&A about the site for members of the workforce navigating the professional setting

DECLARE @X INT = 4500584;

SELECT U.ID USER_ID,P.ID ACTIVITY_ID, YEAR(P.CREATIONDATE) CREATION_DATE, 'POST' ACTIVITY_TYPE
  FROM USERS U
  INNER JOIN POSTS P
  ON U.ID=P.OWNERUSERID
  WHERE U.ID=@X
  AND P.CREATIONDATE >= U.CREATIONDATE
  
UNION ALL

SELECT U.ID USER_ID,C.ID ACTIVITY_ID, YEAR(C.CREATIONDATE) CREATION_DATE, 'COMMENT' ACTIVITY_TYPE
  FROM USERS U
  INNER JOIN COMMENTS C
  ON U.ID=C.USERID
  WHERE U.ID=@X
  AND C.CREATIONDATE >= U.CREATIONDATE

UNION ALL

SELECT U.ID USER_ID,V.ID ACTIVITY_ID, YEAR(V.CREATIONDATE) CREATION_DATE, 'VOTE' ACTIVITY_TYPE
  FROM USERS U
  INNER JOIN VOTES V
  ON U.ID=V.USERID
  WHERE U.ID=@X
  AND V.CREATIONDATE >= U.CREATIONDATE

UNION ALL

SELECT U.ID USER_ID,SEV.ID ACTIVITY_ID, YEAR(SEV.CREATIONDATE) CREATION_DATE, 'SUGGESTEDEDITVOTES' ACTIVITY_TYPE
  FROM USERS U
  INNER JOIN SUGGESTEDEDITVOTES SEV
  ON U.ID=SEV.USERID
  WHERE U.ID=@X
  AND SEV.CREATIONDATE >= U.CREATIONDATE;

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results