Skip to content

Instantly share code, notes, and snippets.

@williamjacksn
Last active September 30, 2015 20:18
Show Gist options
  • Save williamjacksn/1857030 to your computer and use it in GitHub Desktop.
Save williamjacksn/1857030 to your computer and use it in GitHub Desktop.
Rainwave SQL / Find and delete duplicate song ratings
delete from
r4_song_ratings
where
ctid in (
select
min(ctid)
from
r4_song_ratings
where
user_id = %s and
song_id = %s
);
select
user_id,
username,
song_id,
count(song_id)
from
r4_song_ratings
join
phpbb_users using (user_id)
group by
user_id,
username,
song_id
having
count(song_id) > 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment