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

SELECT Query Does NOT Return Syntax Error

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Not a Bug
    • None
    • N/A
    • Parser
    • None

    Description

      The following query does not return a syntax error, but it seems like it should:

      select * from mytest ORDER BY score DESC, individual_id AND service_id=1;
      

      REPO:

      create table mytest (
          individual_id       int(11),
          score               int(11),
          service_id          int(11)
      );
       
      insert into mytest
                  values (1, 10, 5), (2, 11, 5), (3, 12, 2), (4, 20, 2),
                         (5, 21, 1), (6, 22, 1), (7, 30, 1), (8, 31, 4),
                         (9, 32, 6);
       
      select * from mytest
      ORDER BY score DESC, individual_id AND service_id=1;
      

      +---------------+-------+------------+
      | individual_id | score | service_id |
      +---------------+-------+------------+
      |             9 |    32 |          6 |
      |             8 |    31 |          4 |
      |             7 |    30 |          1 |
      |             6 |    22 |          1 |
      |             5 |    21 |          1 |
      |             4 |    20 |          2 |
      |             3 |    12 |          2 |
      |             2 |    11 |          5 |
      |             1 |    10 |          5 |
      +---------------+-------+------------+
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            mpflaum Maria M Pflaum
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.