- 16 Linux
- 7 MySQL
- 5 javascript
- 3 jQuery
- 1 画像
- 6 Google Chorme
- 4 xampp
- 1 css
- 1 PHP
- 3 Poderosa
- 1 LINE API
- 3 Windows
MySQL » サブクエリを使用した連番を振り直すUPDATE
@i := 0;
UPDATE
`table`
SET
`order` = (@i := @i + 1)
WHERE
`id` IN (
SELECT
`id`
FROM
(
SELECT
id
FROM
`table`
WHERE
`column` = 1
ORDER BY
`date`
) AS `tmp`
)
ORDER BY
`order`;