I've got to execute a self-joining sql statement on a derived table in mysql. The derived table involves a hairy subquery, and I'm wondering if there's any alternative to actually writing and executing it twice-
SELECT a.* FROM (my hairy subquery) AS a
LEFT JOIN (my hairy subquery) AS a2
ON a.groupname = a2.groupname etc..