I need to execute a self-signed sql statement in a view in mysql. The resulting table includes a hairy subquery, and I wonder if there is an alternative to writing and running it twice -
SELECT a.* FROM (my hairy subquery) AS a LEFT JOIN (my hairy subquery) AS a2 ON a.groupname = a2.groupname etc..
Yarin source share