Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-6272

SQL Error on perfectly valid query

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Not a Bug
    • None
    • None
    • None
    • None
    • Windows 7

    Description

      I ran the following SQL query:

      update image set image.isMain=1 where not exists (
      select * from image i2 where image.article_id=i2.article_id and image.id < i2.id)

      I receive the following error message:

      SQL Error (1093): Table 'image' is specified twice, both as a target for 'UPDATE' and as a separate source for data

      It is perfectly valid (and often necessary, as in this case) to specify a table twice in this way. This query should work and not return an error.

      Attachments

        Activity

          People

            Unassigned Unassigned
            Timwi Timwi Terby
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.