all posts you have edited with their date and activity information

4

Please login or register to vote for this query.

(click on this box to dismiss)

Gets all posts you have edited and >Gets the difference in months, between when they were created and when they were last active. >Gets the difference in months, between when they were created and when they were **last edited**. This could help you figure how close you are to Excavator and Archeologist

The Workplace Meta

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

SELECT 
 Id as  [Post Link]
 --,CreationDate
 --,LastActivityDate
 ,DATEDIFF(month,CreationDate,GETDATE()) As MonthsAgoCreated
 ,DATEDIFF(month,LastActivityDate,GETDATE()) As MonthsAgoActive
 ,(DATEDIFF(month,CreationDate,GETDATE())-
    DATEDIFF(month,LastActivityDate,GETDATE())) As Creation_Active_DateDiff
 ,DATEDIFF(month,CreationDate,LastEditDate) As Creation_Edit_DateDiff
 ,DATEDIFF(month,LastActivityDate,LastEditDate) As Activ_Edit_DateDiff
FROM 
 Posts
WHERE
 LastEditorUserId = '##UserId##' AND
 OwnerUserId != '##UserId##'
Order By 
--Creation_Active_DateDiff 
 Creation_Edit_DateDiff 
desc

/* As always I'm doing this as a learning exercise and some of my findings 
were

The column alias cannot be referenced in the select portion of the clause:
http://stackoverflow.com/questions/6591183/t-sql-column-alias-on-computed-column-invalid-column-name

*/

Enter Parameters

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