Hey smarties. I'm having trouble with the following SQL statement. I know that I can't do a GROUP BY on the OnlineStatus column, and it makes sense because it's a function call, not an actual column in my table. How would I modify this so that I can get a count of how many users are online?
SELECT CASE dbo.fnGetWebUserOnlineStatus(W.Id)
WHEN 1 THEN 'Online'
WHEN 2 THEN 'Ingame'
ELSE 'Offline'
END AS OnlineStatus
FROM dbo.WebUsers W
WHERE W.[Status]=1
GROUP BY OnlineStatus