[ Release ] SQL - List characters online

04/22/2014 19:42 Timlock#1
Here is a very simple sql query that will list every character logged in.

Code:
SELECT c.CharName16
      ,MAX(n.EventTime) Login
      ,MAX(f.EventTime) Logout
  FROM [SRO_VT_SHARD].[dbo].[_Char] c
  LEFT JOIN [SRO_VT_LOG].[dbo].[_LogEventChar] n ON n.CharID = c.CharID AND n.EventID = 4
  LEFT JOIN [SRO_VT_LOG].[dbo].[_LogEventChar] f ON f.CharID = c.CharID AND f.EventID = 6
  WHERE c.CharID > 0 AND c.Deleted = 0
  GROUP BY c.CharName16
  HAVING MAX(f.EventTime) < MAX(n.EventTime)
Edit the database names as you need.

You might get false positives if your server gets attacked / crashed alot.
04/23/2014 05:09 PortalDark#2
#Approved
04/23/2014 07:53 asanoftw#3
n1
04/23/2014 08:07 globalsilkroad2#4
Good Querry, Thanks :)
04/23/2014 12:06 Tustin1337#5
Nice one , thanks dude.
04/23/2014 13:32 Crue*#6
thanks