当一部分重复几次时,如何保持h2数据库查询SHORT?

我有以下查询,详细讨论了here

select 
    t1.session,t1.center center1,t2.center center2,t1.performance - t2.performance performance
    from mytable t1
    inner join mytable t2 
       on t1.session = t2.session
    WHERE t1.performance = (SELECT MAX(performance) 
                            FROM mytable t3 WHERE t3.session = t1.session)
      AND t2.performance = (SELECT MIN(performance) 
                            FROM mytable t3 WHERE t3.session = t2.session) 

现在,mytable本身是一个非常长的查询(超过一页)。我想知道是否有任何方法可以使用一些常量定义查询(我们通常在Java或C ++中这样做),以避免一次又一次地复制粘贴相同的行。

sd529 回答:当一部分重复几次时,如何保持h2数据库查询SHORT?

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3071450.html

大家都在问