个人资料浏览的徽章查询

是否有办法在个人资料获得超过 X 次浏览时授予徽章?

2 个赞

你好,编码员:

您应该能够使用以下 SQL 创建一个自定义徽章,该徽章将在用户获得超过 X 个观看次数后授予。

个人资料观看次数的徽章查询

SELECT 
  user_profile_views.user_profile_id AS user_id, 
  COUNT(user_profile_views.user_profile_id),
  current_timestamp granted_at
FROM user_profile_views
GROUP BY user_profile_views.user_profile_id
HAVING  COUNT(user_profile_views.user_profile_id) > X 
ORDER BY COUNT(user_profile_views.user_profile_id) DESC

如果您好奇的话,这里还有一个相应的个人资料观看次数的数据浏览器 SQL 查询。

个人资料观看次数的数据浏览器 SQL 查询

-- [params]
-- int :view_count = X

SELECT 
  user_profile_views.user_profile_id AS user_id, 
  COUNT(user_profile_views.user_profile_id) AS "Views",
FROM user_profile_views
GROUP BY user_profile_views.user_profile_id
HAVING  COUNT(user_profile_views.user_profile_id) > :view_count
ORDER BY COUNT(user_profile_views.user_profile_id) DESC

希望这有帮助!

3 个赞

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.