Last umbraco login straight from sql

by Damiaan Peeters 25. November 2014 13:33

If you ever want to have the last login's from your back-end users this is usefull SQL it converts the stored ticks 

select userid , userlogin , useremail, DATEADD(ms, ((ticks - 599266080000000000) - 
   FLOOR((ticks - 599266080000000000) / 864000000000) * 864000000000) / 10000,
   DATEADD(d, (ticks - 599266080000000000) / 864000000000, '01/01/1900')) +
   GETDATE() - GETUTCDATE()
from (
SELECT l.[userID] as userid, u.userLogin as userlogin, u.useremail as useremail
      , min([timeout]) as ticks
  FROM [db16284].[dbo].[umbracoUserLogins] l
  inner join umbracouser u on l.userid = U.id
  where l.userid <> 0
  group by l.userid, u.userLogin, u.useremail
  ) t1
  order by userid desc
blog comments powered by Disqus

Who.I.am

Certified Umbraco Master, Part of Umbraco Certified partner comm-it, .Net and Azure developer, seo lover. Magician in my spare time.

Month List