No, but the pseudo PHP code would look like this:
Code:
$sql = "SELECT id FROM ... WHERE you want to keep the row";
$ids = execute_sql_and_fetch_each_id_into_an_array($sql);
$idlist = join(', ', $ids);
$sql = "DELETE FROM ... WHERE id NOT IN ($ids)";
execute($sql);