Use SELECT a, b, X.* FROM (SELECT ...) AS X to avoid rewriting a SELECT stmt.