Skip to content

Issue with comma with multi FROM #76

Open
@ReynaldBarbeaut

Description

@ReynaldBarbeaut

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.

Activity

linked a pull request that will close this issue on Mar 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @ReynaldBarbeaut

      Issue actions

        Issue with comma with multi FROM · Issue #76 · thecodingmachine/magic-query