Thread

  1. Re: [HACKERS] Group By, NULL values and inconsistent behaviour.

    Zeugswetter Andreas <andreas.zeugswetter@telecom.at> — 1998-01-26T11:39:07Z

    The following is Informix behavior:
    
    informix@zeus:/usr/informix72> dbaccess - -
    > create database nulltest in datadbs;
    Database created.
    
    > create table t1 (a int4, b char(2), c char(2));
      201: A syntax error has occurred.
    Error in line 1
    Near character position 20
    
    > create table t1 (a int, b char(2), c char(2));
    Table created.
    
    > insert into t1 (a,c) values (1,'x');
    1 row(s) inserted.
    > insert into t1 (a,c) values (2,'x');
    1 row(s) inserted.
    > insert into t1 (a,c) values (3,'z');
    1 row(s) inserted.
    > insert into t1 (a,c) values (2,'x');
    1 row(s) inserted.
    > select * from t1;
              a b  c
              1    x
              2    x
              3    z
              2    x
    
    4 row(s) retrieved.
    > select b,c,sum(a) from t1 group by b,c;
    b  c             (sum)
    
       x                 5
       z                 3
    
    2 row(s) retrieved.
    > select b,c,sum(a) from t1 group by b,c order by c;
    b  c             (sum)
    
       x                 5
       z                 3
    
    2 row(s) retrieved.
    >
    
    
    Andreas