Skip to content

Instantly share code, notes, and snippets.

@sandyGanoti
Last active September 25, 2018 21:53
Show Gist options
  • Save sandyGanoti/5ffbc9c806f68dac3c4c8c4b8e86d617 to your computer and use it in GitHub Desktop.
Save sandyGanoti/5ffbc9c806f68dac3c4c8c4b8e86d617 to your computer and use it in GitHub Desktop.
-- update survived scoreGroup for non official leaderboards, set user_ids equals to the comma-separated-winner-users
update score_group set user_ids=(select substring_index(GROUP_CONCAT(DISTINCT pickem.entry.user_id SEPARATOR ','), ',', 30) as expecting_ids from user_leaderboard left join pickem.entry on pickem.entry.user_id=user_leaderboard.user_id where pickem.entry.winner=1 and pickem.entry.contest_id=1 and leaderboard_id=score_group.leaderboard_id) where leaderboard_id in (select id from leaderboard where official=0) and name="Survived";
-- update eliminated scoreGroup for non official leaderboards, set user_ids equals to the comma-separated-eliminated-users
update score_group set user_ids=(select substring_index(GROUP_CONCAT(DISTINCT pickem.entry.user_id SEPARATOR ','), ',', 30) as expecting_ids from user_leaderboard left join pickem.entry on pickem.entry.user_id=user_leaderboard.user_id where pickem.entry.winner=0 and pickem.entry.contest_id=1 and leaderboard_id=score_group.leaderboard_id) where leaderboard_id in (select id from leaderboard where official=0) and name="Eliminated";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment