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

JSON Data Type #334

Open
Phantom-LGTM opened this issue Jan 29, 2021 · 0 comments
Open

JSON Data Type #334

Phantom-LGTM opened this issue Jan 29, 2021 · 0 comments

Comments

@Phantom-LGTM
Copy link

Phantom-LGTM commented Jan 29, 2021

Hi your parser doesn't support JSON_TABLE.

`SELECT
    GROUP_CONCAT(IF(med_conditions.type_fw = 1, NULL, med_conditions.id) SEPARATOR ', ') AS factors
  , GROUP_CONCAT(IF(med_conditions.type_fw = 0, NULL, med_conditions.id) SEPARATOR ', ') AS works
FROM med_rules
LEFT JOIN  (
      select med_rules.id
      ,      factors_works.factor_work_id
      ,      0 AS type_fw
      FROM med_rules
      JOIN JSON_TABLE(med_rules.harmful_factors_works, "$[*]" COLUMNS (factor_work_id INT PATH "$[0]")) AS factors_works
    ) AS rules_factors_works ON (med_rules.id = rules_factors_works.id)
LEFT JOIN med_conditions ON(rules_factors_works.factor_work_id = med_conditions.id)

WHERE  med_rules.id = {{id}}

GROUP BY med_rules.id
LIMIT 1`

When processing a request with a parser, it ignores the contents of the function.
As a result:

`SELECT GROUP_CONCAT(IF(med_conditions.type_fw = 1, NULL, med_conditions.id) SEPARATOR ', ') AS factors,
       GROUP_CONCAT(IF(med_conditions.type_fw = 0, NULL, med_conditions.id) SEPARATOR ', ') AS works
FROM med_rules
         LEFT JOIN (SELECT med_rules.id, factors_works.factor_work_id, 0 AS type_fw
                    FROM med_rules
                             **INNER JOIN JSON_TABLE AS factors_works) AS rules_factors_works**
                   ON (med_rules.id = rules_factors_works.id)
         LEFT JOIN med_conditions ON (rules_factors_works.factor_work_id = med_conditions.id)
WHERE med_rules.id = {{id}}
GROUP BY med_rules.id
LIMIT 1`

Are there any plans to update the functionality? When can this be expected?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant