テーブルから重複を削除したいgame
。同じplayerId
とtimeParameter
のエントリがあり、最低のものはgameId
のエントリが残ります。エイリアスなしで削除
私はエントリを照会することができます
select a.`gameId` from `game` a
where not exists
(select min(b.`gameId`) as m from `game` b
group by b.`playerId`, b.`timeParameter`
having m = a.`gameId`);
しかし、私はALIS delete文で使用することはできません:構文エラーを取得
delete from `game` a
where not exists
(select min(b.`gameId`) as m from `game` b
group by b.`playerId`, b.`timeParameter`
having m = a.`gameId`);
を:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual
that corresponds to your MariaDB server version for the right syntax to use near 'a
where not exists
(select min(b.`gameId`) as m from `game` b
group by b.`' at line 1
このエラーは何も表示されませんが、削除でエイリアスを使用することはできませんステートメント。
解決方法はありますか?
も、あなたはselect文を使用してこれを削除することはできません同じテーブルで –
これを見てくださいhttp://stackoverflow.com/questions/4562787/how-to-delete-from-select-in-mysql – rpd
@vertexそれとも? –