Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

子查询中没办法引用父查询的字段 #382

Open
GITWEIZ opened this issue Apr 6, 2022 · 1 comment
Open

子查询中没办法引用父查询的字段 #382

GITWEIZ opened this issue Apr 6, 2022 · 1 comment
Labels
Document 文档 文档 Enhancement 增强 增强功能、提高性能等

Comments

@GITWEIZ
Copy link

GITWEIZ commented Apr 6, 2022

环境信息

  • 系统: Windows 10
  • JDK: 1.8.0_17
  • 数据库: MySQL 8.0.28
  • APIJSON: 4.9.1

问题描述

子查询中没办法引用父查询的字段
数据库结构和数据如下:
image
image
image
image
apijson如下:

{
  "[]": {
    "Lrx_student": {
      "sid}{@": {
        "from": "Lrx_score",
        "Lrx_score": {
          "@column": "sid;grade",
          "sid@": "[]/Lrx_student/sid", //没办法引用
          "grade>":"90"
        }
      }
    }
  },
  "@schema": "lrx"
}

结果如下:
image

错误信息

@TommyLemon
Copy link
Collaborator

TommyLemon commented Apr 7, 2022

目前不支持在子查询中引用赋值,可以反过来写,EXISTS 改为 IN,里面就不需要引用赋值(外键关联)键值对了

{
  "[]": {
    "Lrx_student": {
      "sid{}@": {
        "from": "Lrx_score",
        "Lrx_score": {
          "@column": "sid;grade",
          "grade>":"90"
        }
      }
    }
  },
  "@schema": "lrx"
}

https://github.com/Tencent/APIJSON/blob/master/Document.md#3.2
image

打算后续支持在子查询中引用赋值,可以在建议收集箱 issue 提个建议看看多少人点赞(需要这个功能)
#37

@TommyLemon TommyLemon added Enhancement 增强 增强功能、提高性能等 Document 文档 文档 labels Apr 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Document 文档 文档 Enhancement 增强 增强功能、提高性能等
Projects
None yet
Development

No branches or pull requests

2 participants