Welcome Guest! To enable all features please
Login or Register.
Can somebody help me with creating a query that is grouping number of Thanks by email. I would like to reward the most thanked users so I need to generate a list.
Thanks!
Here's what I use to get the most X thanks by userID for the last 7 days. Just remove the where clause and well whatever ya want. This should help you get going.
DECLARE @Topper INT = @Top
SELECT TOP (@Topper) yaf_User.UserID, yaf_User.Name, COUNT(ThanksToUserID) as Total
FROM yaf_Thanks
INNER JOIN yaf_User
ON yaf_Thanks.ThanksToUserID = yaf_User.UserID
INNER JOIN yaf_Message
ON yaf_Message.MessageID = yaf_Thanks.MessageID
INNER JOIN yaf_Topic
ON yaf_Topic.TopicID = yaf_Message.TopicID
WHERE yaf_Thanks.ThanksDate > DATEADD(DAY, -7, GETDATE())
GROUP BY yaf_Thanks.ThanksToUserID, yaf_User.Name, yaf_user.UserID
ORDER BY COUNT(ThanksToUserID) DESC
Forum Jump
- You cannot post new topics in this forum.
- You cannot reply to topics in this forum.
- You cannot delete your posts in this forum.
- You cannot edit your posts in this forum.
- You cannot create polls in this forum.
- You cannot vote in polls in this forum.
Important Information:
The YAF.NET Support Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close