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

Different result when group by with correct function

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8
    • None
    • Server
    • None
    • Linux

    Description

      create table t (c int);
      insert into t values (20121212),(9),(19800101),(20121212),(19800101);
       
      select c, count(*) from t group by  c desc with rollup; 
       
      MariaDB [test]> select c, count(*) from t group by c desc with rollup; 
      +----------+----------+
      | c              | count(*) |
      +----------+----------+
      | 20121212 |        2 |
      | 19800101 |        2 |
      |        9           |        1 |
      |     NULL     |        5 |
      +----------+----------+
      4 rows in set (0.001 sec)
       
      select c, count(*) from t group by convert(c, int) desc with rollup; 
      MariaDB [test]> select c, count(*) from t group by convert(c,int) desc with rollup; 
      +----------+----------+
      | c              | count(*) |
      +----------+----------+
      | 20121212 |        2 |
      | 19800101 |        2 |
      |        9           |        1 |
      |        9           |        5 |
      +----------+----------+
      

      When the group by with rollup in correct function ,there will be have different results.

      Attachments

        1. group by withoutconvert. png.png
          13 kB
          Marco Zhang
        2. 图片3.png
          14 kB
          Marco Zhang

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Marco Marco Zhang
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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