DELETEFROM leaderboard_guilds lgUSING ( SELECT id, guild_id, snapshot_timestamp, ROW_NUMBER() OVER (PARTITION BY guild_id, snapshot_timestamp::date ORDER BY id) AS row_num FROM leaderboard_guilds) rg WHERE rg.row_num > 1 and rg.guild_id = lg.guild_id and rg.snapshot_timestamp = lg.snapshot_timestamp and rg.id = lg.id;
delete where id = ''
var count = await conn.ExecuteAsync(sql: sql, transaction: transaction, commandType: CommandType.Text);