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

Issue with comma with multi FROM #76

Open
ReynaldBarbeaut opened this issue Mar 12, 2021 · 0 comments · May be fixed by #77
Open

Issue with comma with multi FROM #76

ReynaldBarbeaut opened this issue Mar 12, 2021 · 0 comments · May be fixed by #77

Comments

@ReynaldBarbeaut
Copy link

Hello,

We have this example:

SELECT COUNT(B.*) FROM (SELECT tags.id FROM tags,
            (SELECT t.* FROM tags t WHERE t.id IN (0,1,2)) as childTag
            WHERE tags.lft < childTag.lft AND tags.rgt > childTag.rgt AND tags.depth = 2) as B

So we see that we are using 2 tables in the FROM and after MagicQuery it's removing the comma.
Response from MQ:

SELECT 
  COUNT(  `B`.*)
FROM   (SELECT 
    `tags`.`id`
FROM     `tags`     (SELECT 
      `t`.*
FROM       `tags` `t`
WHERE             `t`.`id` IN       (      0,      1,      2)) `childTag`
WHERE     (        `tags`.`lft` <     `childTag`.`lft`)
    AND (        `tags`.`rgt` >     `childTag`.`rgt`)
    AND (        `tags`.`depth` =     2)) `B`

Do you have any solution ?
Thank you.

@homersimpsons homersimpsons linked a pull request Mar 18, 2021 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant