代码之家  ›  专栏  ›  技术社区  ›  eto

WITH子句中未定义变量

  •  1
  • eto  · 技术社区  · 7 年前

    在以下查询中

    MATCH (i:UT)-[c:Cedes]->(r:UT) 
    WHERE i.RiIndex=0
    WITH r, c, i, (CASE WHEN i.gross > c.xs THEN i.gross-c.xs ELSE 0 END) AS mn
    RETURN r, sum(c.pp*(mn)) AS  ceded
    

    MATCH (i:UT)-[c:Cedes]->(r:UT) 
    WHERE i.RiIndex=0
    WITH r, c, i, (CASE WHEN i.gross > c.xs THEN i.gross-c.xs ELSE 0 END) AS mn, (CASE WHEN c.lim < mn THEN c.lim ELSE mn END) AS mx
    RETURN r, sum(c.pp*(mx)) AS  ceded
    

    Variable `mn` not defined (line 3, column 97 (offset: 146))
    "WITH r, c, i, (CASE WHEN i.gross > c.xs THEN i.gross-c.xs ELSE 0 END) AS mn, (CASE WHEN c.lim < mn THEN c.lim ELSE mn END) AS mx"
                                                                                                     ^
    

    是否有人可以建议是否有方法将“mn”变量传递给创建“mx”变量的函数?

    1 回复  |  直到 7 年前
        1
  •  1
  •   InverseFalcon    7 年前

    在WITH子句中, mn

    MATCH (i:UT)-[c:Cedes]->(r:UT) 
    WHERE i.RiIndex=0
    WITH r, c, i, (CASE WHEN i.gross > c.xs THEN i.gross-c.xs ELSE 0 END) AS mn
    WITH r, c, i, (CASE WHEN c.lim < mn THEN c.lim ELSE mn END) AS mx
    RETURN r, sum(c.pp*(mx)) AS  ceded