[英]Self-joins on derived tables in mysql- do i need to repeat the subqueries?
I've got to execute a self-joining sql statement on a derived table in mysql. 我必须在mysql中的派生表上执行自连接的sql语句。 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..
The standard solution to this is to use CTEs, but these are not yet supported in MySQL. 对此的标准解决方案是使用CTE,但MySQL尚不支持这些。 Alternatives are: 替代方案是:
Related 有关
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.