Skip to content

Instantly share code, notes, and snippets.

@kphrx
Last active August 20, 2019 11:13
Show Gist options
  • Save kphrx/227bc086222dc22735dfbeb70557a6da to your computer and use it in GitHub Desktop.
Save kphrx/227bc086222dc22735dfbeb70557a6da to your computer and use it in GitHub Desktop.
MyFleetGirls Delete Old Version Resources
DELETE FROM map_image_2nd
WHERE EXISTS (
SELECT 1
FROM map_image_2nd AS m
WHERE map_image_2nd.area_id = m.area_id
AND map_image_2nd.info_no = m.info_no
AND map_image_2nd.suffix = m.suffix
AND map_image_2nd.version < m.version
);
DELETE FROM ship_image
WHERE EXISTS (
SELECT 1
FROM ship_image AS s
WHERE ship_image.id = s.id
AND ship_image.version < s.version
);
DELETE FROM ship_image_2nd
WHERE EXISTS (
SELECT 1
FROM ship_image_2nd AS s
WHERE ship_image_2nd.id = s.id
AND ship_image_2nd.kind = s.kind
AND ship_image_2nd.version < s.version
);
DELETE FROM ship_sound
WHERE EXISTS (
SELECT 1
FROM ship_sound AS s
WHERE ship_sound.ship_id = s.ship_id
AND ship_sound.sound_id = s.sound_id
AND ship_sound.version < s.version
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment