cat > script <<'+-+-+-+-+-END-OF-FILE-+-+-+-+-+'
create d1 set a, b;
insert into d1 values (1, 2, 2, 3, 3, 4, 2, 3, 1, 2);
select from d1;
select distinct * from d1;
select a from d1;
select distinct a from d1;
select b from d1;
select distinct b from d1;
select a from d1 group by a order by a;
select distinct a from d1 group by a order by a;
select sum (a) from d1;
select distinct sum (a) from d1;
select a, sum (b) from d1;
select distinct a, sum (b) from d1;
select a, b from d1 group by a order by a;
select distinct a, b from d1 group by a order by a;
select a, b, sum (b) from d1 group by a order by a;
select distinct a, b, sum (b) from d1 group by a order by a;
select a, sum (b) from d1 group by a order by a;
+-+-+-+-+-END-OF-FILE-+-+-+-+-+
chmod 644 script
cat > stdout <<'+-+-+-+-+-END-OF-FILE-+-+-+-+-+'
* create d1 set a, b;
* insert into d1 values (1, 2, 2, 3, 3, 4, 2, 3, 1, 2);
* select from d1;
     a       b

     1       2
     2       3
     3       4
     2       3
     1       2
* select distinct * from d1;
     a       b

     1       2
     2       3
     3       4
* select a from d1;
     a

     1
     2
     3
     2
     1
* select distinct a from d1;
     a

     1
     2
     3
* select b from d1;
     b

     2
     3
     4
     3
     2
* select distinct b from d1;
     b

     2
     3
     4
* select a from d1 group by a order by a;
     a

     1
     2
     3
* select distinct a from d1 group by a order by a;
     a

     1
     2
     3
* select sum (a) from d1;
     SUM(a)

          9
* select distinct sum (a) from d1;
     SUM(a)

          9
* select a, sum (b) from d1;
     a       SUM(b)

     1
     2
     3
     2
     1
                 14
* select distinct a, sum (b) from d1;

*** Error: invalid select list with select distinct
* select a, b from d1 group by a order by a;
     a       b

     1       2
     1       2
     1
     2       3
     2       3
     2
     3       4
     3
* select distinct a, b from d1 group by a order by a;

*** Error: invalid select list with select distinct
* select a, b, sum (b) from d1 group by a order by a;
     a       b       SUM(b)

     1       2
     1       2
     1                    4
     2       3
     2       3
     2                    6
     3       4
     3                    4
* select distinct a, b, sum (b) from d1 group by a order by a;

*** Error: invalid select list with select distinct
* select a, sum (b) from d1 group by a order by a;
     a       SUM(b)

     1            4
     2            6
     3            4
* 
+-+-+-+-+-END-OF-FILE-+-+-+-+-+
chmod 644 stdout
cat > tag <<'+-+-+-+-+-END-OF-FILE-+-+-+-+-+'
Test for distinct.
+-+-+-+-+-END-OF-FILE-+-+-+-+-+
chmod 644 tag
cat > stdout.jp_euc <<'+-+-+-+-+-END-OF-FILE-+-+-+-+-+'
* create d1 set a, b;
* insert into d1 values (1, 2, 2, 3, 3, 4, 2, 3, 1, 2);
* select from d1;
     a       b

     1       2
     2       3
     3       4
     2       3
     1       2
* select distinct * from d1;
     a       b

     1       2
     2       3
     3       4
* select a from d1;
     a

     1
     2
     3
     2
     1
* select distinct a from d1;
     a

     1
     2
     3
* select b from d1;
     b

     2
     3
     4
     3
     2
* select distinct b from d1;
     b

     2
     3
     4
* select a from d1 group by a order by a;
     a

     1
     2
     3
* select distinct a from d1 group by a order by a;
     a

     1
     2
     3
* select sum (a) from d1;
     SUM(a)

          9
* select distinct sum (a) from d1;
     SUM(a)

          9
* select a, sum (b) from d1;
     a       SUM(b)

     1
     2
     3
     2
     1
                 14
* select distinct a, sum (b) from d1;

*** Error: ̵ʥˡդ SELECT ꥹȤǤ
* select a, b from d1 group by a order by a;
     a       b

     1       2
     1       2
     1
     2       3
     2       3
     2
     3       4
     3
* select distinct a, b from d1 group by a order by a;

*** Error: ̵ʥˡդ SELECT ꥹȤǤ
* select a, b, sum (b) from d1 group by a order by a;
     a       b       SUM(b)

     1       2
     1       2
     1                    4
     2       3
     2       3
     2                    6
     3       4
     3                    4
* select distinct a, b, sum (b) from d1 group by a order by a;

*** Error: ̵ʥˡդ SELECT ꥹȤǤ
* select a, sum (b) from d1 group by a order by a;
     a       SUM(b)

     1            4
     2            6
     3            4
* 
+-+-+-+-+-END-OF-FILE-+-+-+-+-+
chmod 644 stdout.jp_euc
