Current Path : /home/usr.opt/mysql57/mysql-test/suite/engines/funcs/r/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //home/usr.opt/mysql57/mysql-test/suite/engines/funcs/r/se_string_having.result |
DROP TABLE IF EXISTS t1; CREATE TABLE t1(c1 CHAR(1) NULL, c2 CHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 CHAR(1) NULL, c2 CHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 CHAR(1) NULL, c2 CHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 CHAR(1) NULL, c2 CHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 CHAR(1) NULL, c2 CHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 CHAR(1) NULL, c2 CHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 CHAR(1) NULL, c2 CHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARCHAR(1) NULL, c2 VARCHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARCHAR(1) NULL, c2 VARCHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARCHAR(1) NULL, c2 VARCHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARCHAR(1) NULL, c2 VARCHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARCHAR(1) NULL, c2 VARCHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARCHAR(1) NULL, c2 VARCHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARCHAR(1) NULL, c2 VARCHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BINARY(1) NULL, c2 BINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BINARY(1) NULL, c2 BINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BINARY(1) NULL, c2 BINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BINARY(1) NULL, c2 BINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BINARY(1) NULL, c2 BINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BINARY(1) NULL, c2 BINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BINARY(1) NULL, c2 BINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARBINARY(1) NULL, c2 VARBINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARBINARY(1) NULL, c2 VARBINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARBINARY(1) NULL, c2 VARBINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARBINARY(1) NULL, c2 VARBINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARBINARY(1) NULL, c2 VARBINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARBINARY(1) NULL, c2 VARBINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARBINARY(1) NULL, c2 VARBINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BLOB(1) NULL, c2 BLOB(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BLOB(1) NULL, c2 BLOB(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BLOB(1) NULL, c2 BLOB(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BLOB(1) NULL, c2 BLOB(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BLOB(1) NULL, c2 BLOB(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BLOB(1) NULL, c2 BLOB(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BLOB(1) NULL, c2 BLOB(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 TEXT(1) NULL, c2 TEXT(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 TEXT(1) NULL, c2 TEXT(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 TEXT(1) NULL, c2 TEXT(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 TEXT(1) NULL, c2 TEXT(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 TEXT(1) NULL, c2 TEXT(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 TEXT(1) NULL, c2 TEXT(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 TEXT(1) NULL, c2 TEXT(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 1; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 1; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 1; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 CHAR(1) NULL, c2 CHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 CHAR(1) NULL, c2 CHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 CHAR(1) NULL, c2 CHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 CHAR(1) NULL, c2 CHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 CHAR(1) NULL, c2 CHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 CHAR(1) NULL, c2 CHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 CHAR(1) NULL, c2 CHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARCHAR(1) NULL, c2 VARCHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARCHAR(1) NULL, c2 VARCHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARCHAR(1) NULL, c2 VARCHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARCHAR(1) NULL, c2 VARCHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARCHAR(1) NULL, c2 VARCHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARCHAR(1) NULL, c2 VARCHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARCHAR(1) NULL, c2 VARCHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BINARY(1) NULL, c2 BINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BINARY(1) NULL, c2 BINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BINARY(1) NULL, c2 BINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BINARY(1) NULL, c2 BINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BINARY(1) NULL, c2 BINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BINARY(1) NULL, c2 BINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BINARY(1) NULL, c2 BINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARBINARY(1) NULL, c2 VARBINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARBINARY(1) NULL, c2 VARBINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARBINARY(1) NULL, c2 VARBINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARBINARY(1) NULL, c2 VARBINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARBINARY(1) NULL, c2 VARBINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARBINARY(1) NULL, c2 VARBINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARBINARY(1) NULL, c2 VARBINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BLOB(1) NULL, c2 BLOB(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BLOB(1) NULL, c2 BLOB(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BLOB(1) NULL, c2 BLOB(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BLOB(1) NULL, c2 BLOB(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BLOB(1) NULL, c2 BLOB(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BLOB(1) NULL, c2 BLOB(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BLOB(1) NULL, c2 BLOB(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 TEXT(1) NULL, c2 TEXT(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 TEXT(1) NULL, c2 TEXT(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 TEXT(1) NULL, c2 TEXT(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 TEXT(1) NULL, c2 TEXT(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 TEXT(1) NULL, c2 TEXT(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 TEXT(1) NULL, c2 TEXT(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 TEXT(1) NULL, c2 TEXT(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 2; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 2; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 2; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 CHAR(1) NULL, c2 CHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 CHAR(1) NULL, c2 CHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 CHAR(1) NULL, c2 CHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 CHAR(1) NULL, c2 CHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 CHAR(1) NULL, c2 CHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 CHAR(1) NULL, c2 CHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 CHAR(1) NULL, c2 CHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARCHAR(1) NULL, c2 VARCHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARCHAR(1) NULL, c2 VARCHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARCHAR(1) NULL, c2 VARCHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARCHAR(1) NULL, c2 VARCHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARCHAR(1) NULL, c2 VARCHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARCHAR(1) NULL, c2 VARCHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARCHAR(1) NULL, c2 VARCHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BINARY(1) NULL, c2 BINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BINARY(1) NULL, c2 BINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BINARY(1) NULL, c2 BINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BINARY(1) NULL, c2 BINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BINARY(1) NULL, c2 BINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BINARY(1) NULL, c2 BINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BINARY(1) NULL, c2 BINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARBINARY(1) NULL, c2 VARBINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARBINARY(1) NULL, c2 VARBINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARBINARY(1) NULL, c2 VARBINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARBINARY(1) NULL, c2 VARBINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARBINARY(1) NULL, c2 VARBINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARBINARY(1) NULL, c2 VARBINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARBINARY(1) NULL, c2 VARBINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BLOB(1) NULL, c2 BLOB(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BLOB(1) NULL, c2 BLOB(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BLOB(1) NULL, c2 BLOB(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BLOB(1) NULL, c2 BLOB(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BLOB(1) NULL, c2 BLOB(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BLOB(1) NULL, c2 BLOB(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BLOB(1) NULL, c2 BLOB(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 TEXT(1) NULL, c2 TEXT(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 TEXT(1) NULL, c2 TEXT(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 TEXT(1) NULL, c2 TEXT(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 TEXT(1) NULL, c2 TEXT(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 TEXT(1) NULL, c2 TEXT(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 TEXT(1) NULL, c2 TEXT(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 TEXT(1) NULL, c2 TEXT(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 3; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 3; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 3; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 CHAR(1) NULL, c2 CHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 CHAR(1) NULL, c2 CHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 CHAR(1) NULL, c2 CHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) c a 9 5 c b 9 5 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) c a 9 5 c b 9 5 SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) a c 9 5 b c 9 5 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) a c 9 5 b c 9 5 DROP TABLE t1; CREATE TABLE t1(c1 CHAR(1) NULL, c2 CHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 CHAR(1) NULL, c2 CHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 CHAR(1) NULL, c2 CHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 CHAR(1) NULL, c2 CHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARCHAR(1) NULL, c2 VARCHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARCHAR(1) NULL, c2 VARCHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARCHAR(1) NULL, c2 VARCHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) c a 9 5 c b 9 5 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) c a 9 5 c b 9 5 SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) a c 9 5 b c 9 5 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) a c 9 5 b c 9 5 DROP TABLE t1; CREATE TABLE t1(c1 VARCHAR(1) NULL, c2 VARCHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARCHAR(1) NULL, c2 VARCHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARCHAR(1) NULL, c2 VARCHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARCHAR(1) NULL, c2 VARCHAR(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BINARY(1) NULL, c2 BINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BINARY(1) NULL, c2 BINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BINARY(1) NULL, c2 BINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) c a 9 5 c b 9 5 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) c a 9 5 c b 9 5 SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) a c 9 5 b c 9 5 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) a c 9 5 b c 9 5 DROP TABLE t1; CREATE TABLE t1(c1 BINARY(1) NULL, c2 BINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BINARY(1) NULL, c2 BINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BINARY(1) NULL, c2 BINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BINARY(1) NULL, c2 BINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARBINARY(1) NULL, c2 VARBINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARBINARY(1) NULL, c2 VARBINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARBINARY(1) NULL, c2 VARBINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) c a 9 5 c b 9 5 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) c a 9 5 c b 9 5 SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) a c 9 5 b c 9 5 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) a c 9 5 b c 9 5 DROP TABLE t1; CREATE TABLE t1(c1 VARBINARY(1) NULL, c2 VARBINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARBINARY(1) NULL, c2 VARBINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARBINARY(1) NULL, c2 VARBINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 VARBINARY(1) NULL, c2 VARBINARY(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BLOB(1) NULL, c2 BLOB(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BLOB(1) NULL, c2 BLOB(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BLOB(1) NULL, c2 BLOB(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) c a 9 5 c b 9 5 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) c a 9 5 c b 9 5 SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) a c 9 5 b c 9 5 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) a c 9 5 b c 9 5 DROP TABLE t1; CREATE TABLE t1(c1 BLOB(1) NULL, c2 BLOB(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BLOB(1) NULL, c2 BLOB(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BLOB(1) NULL, c2 BLOB(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 BLOB(1) NULL, c2 BLOB(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 TEXT(1) NULL, c2 TEXT(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='a' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 TEXT(1) NULL, c2 TEXT(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='b' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 TEXT(1) NULL, c2 TEXT(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) c a 9 5 c b 9 5 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) c a 9 5 c b 9 5 SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) a c 9 5 b c 9 5 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='c' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) a c 9 5 b c 9 5 DROP TABLE t1; CREATE TABLE t1(c1 TEXT(1) NULL, c2 TEXT(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='d' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 TEXT(1) NULL, c2 TEXT(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='e' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 TEXT(1) NULL, c2 TEXT(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='f' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1; CREATE TABLE t1(c1 TEXT(1) NULL, c2 TEXT(1) NULL, c3 INT NULL); TRUNCATE TABLE t1; INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',1), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',1), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',1), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',1), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',3), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',3), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',3), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',3), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',2), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',2), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',2), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',2), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',7), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',7), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',7), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',7), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',6), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',6), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',6), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',6), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',4), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',4), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',4), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',4), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',5), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',5), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',5), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',5), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',9), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',9), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',9), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',9), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','a',8), ('a','a',2), ('a','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','a',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','a',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); INSERT INTO t1 (c1,c2,c3) VALUES ('a','b',8), ('a','b',2), ('b','b',3), ('a','c',4), ('a','d',5); INSERT INTO t1 (c1,c2,c3) VALUES ('b','b',1), ('b','a',8), ('b','c',6), ('b','e',4), ('b','z',5); INSERT INTO t1 (c1,c2,c3) VALUES ('c','b',5), ('c','c',7), ('c','c',8), ('c','d',9), ('c','f',5); SELECT c1 FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 SELECT c1,COUNT(*) FROM t1 GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1 HAVING COUNT(*) = 9; c1 COUNT(*) MAX(c3) SELECT c1,c2 FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 c a c b SELECT c1,c2,COUNT(*) FROM t1 GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) c a 9 c b 9 SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c1,c2,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c1,c2 HAVING COUNT(*) = 9; c1 c2 COUNT(*) MAX(c3) SELECT c2,c1 FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 a c b c SELECT c2,c1,COUNT(*) FROM t1 GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) a c 9 b c 9 SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) SELECT c2,c1,COUNT(*),MAX(c3) FROM t1 WHERE c1='y' OR c2 = '#C2' GROUP BY c2,c1 HAVING COUNT(*) = 9; c2 c1 COUNT(*) MAX(c3) DROP TABLE t1;