0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

mysql update items under safe update

Last updated at Posted at 2025-06-09
DELETE FROM instances
WHERE instance_id IN (
  SELECT instance_id FROM (
    SELECT instance_id FROM instances
    WHERE name IN ('character_A', 'character_B')
  ) AS safe_subquery
);
UPDATE instances
SET shot = LPAD(SUBSTRING_INDEX(shot, '.', 1), 3, '0')
WHERE shot LIKE '%.0'
  AND instance_id IN (
    SELECT instance_id FROM (
      SELECT instance_id FROM instances
      WHERE shot LIKE '%.0'
    ) AS safe_subquery
  );

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?