mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
COUNT(DISTINCT x) is now fully functional, though it could benefit from
additional testing. (CVS 2688) FossilOrigin-Name: 2f397bd8142ec5e8f7238127012d14fdb558d918
This commit is contained in:
44
test/distinctagg.test
Normal file
44
test/distinctagg.test
Normal file
@ -0,0 +1,44 @@
|
||||
# 2005 September 11
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this script is the DISTINCT modifier on aggregate functions.
|
||||
#
|
||||
# $Id: distinctagg.test,v 1.1 2005/09/11 11:56:28 drh Exp $
|
||||
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
|
||||
do_test distinctagg-1.1 {
|
||||
execsql {
|
||||
CREATE TABLE t1(a,b,c);
|
||||
INSERT INTO t1 VALUES(1,2,3);
|
||||
INSERT INTO t1 VALUES(1,3,4);
|
||||
INSERT INTO t1 VALUES(1,3,5);
|
||||
SELECT count(distinct a),
|
||||
count(distinct b),
|
||||
count(distinct c),
|
||||
count(all a) FROM t1;
|
||||
}
|
||||
} {1 2 3 3}
|
||||
do_test distinctagg-1.2 {
|
||||
execsql {
|
||||
SELECT b, count(distinct c) FROM t1 GROUP BY b ORDER BY b
|
||||
}
|
||||
} {2 1 3 2}
|
||||
|
||||
do_test distinctagg-2.1 {
|
||||
catchsql {
|
||||
SELECT count(distinct) FROM t1;
|
||||
}
|
||||
} {1 {DISTINCT in aggregate must be followed by an expression}}
|
||||
|
||||
finish_test
|
Reference in New Issue
Block a user