Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
5e599717
Commit
5e599717
authored
Mar 27, 2006
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge joreland@bk-internal.mysql.com:/home/bk/mysql-5.0
into perch.ndb.mysql.com:/home/jonas/src/mysql-5.0
parents
d5ea29f4
b3230cc2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
0 deletions
+75
-0
mysql-test/r/group_min_max.result
mysql-test/r/group_min_max.result
+37
-0
mysql-test/t/group_min_max.test
mysql-test/t/group_min_max.test
+38
-0
No files found.
mysql-test/r/group_min_max.result
View file @
5e599717
...
...
@@ -2070,3 +2070,40 @@ SELECT a FROM t1 WHERE a LIKE 'B%' GROUP BY a;
a
BB
DROP TABLE t1;
CREATE TABLE t1 (
a int(11) NOT NULL DEFAULT '0',
b varchar(16) COLLATE latin1_general_ci NOT NULL DEFAULT '',
PRIMARY KEY (a,b)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
CREATE PROCEDURE a(x INT)
BEGIN
DECLARE rnd INT;
DECLARE cnt INT;
WHILE x > 0 DO
SET rnd= x % 100;
SET cnt = (SELECT COUNT(*) FROM t1 WHERE a = rnd);
INSERT INTO t1(a,b) VALUES (rnd, CAST(cnt AS CHAR));
SET x= x - 1;
END WHILE;
END|
CALL a(1000);
SELECT a FROM t1 WHERE a=0;
a
0
0
0
0
0
0
0
0
0
0
SELECT DISTINCT a FROM t1 WHERE a=0;
a
0
SELECT COUNT(DISTINCT a) FROM t1 WHERE a=0;
COUNT(DISTINCT a)
1
DROP TABLE t1;
DROP PROCEDURE a;
mysql-test/t/group_min_max.test
View file @
5e599717
...
...
@@ -736,3 +736,41 @@ SELECT DISTINCT a FROM t1 WHERE a LIKE 'B%';
SELECT a FROM t1 WHERE a LIKE '
B
%
' GROUP BY a;
DROP TABLE t1;
#
# Bug #15102: select distinct returns empty result, select count
# distinct > 0 (correct)
#
CREATE TABLE t1 (
a int(11) NOT NULL DEFAULT '
0
',
b varchar(16) COLLATE latin1_general_ci NOT NULL DEFAULT '
'
,
PRIMARY
KEY
(
a
,
b
)
)
ENGINE
=
MyISAM
DEFAULT
CHARSET
=
latin1
COLLATE
=
latin1_general_ci
;
delimiter
|
;
CREATE
PROCEDURE
a
(
x
INT
)
BEGIN
DECLARE
rnd
INT
;
DECLARE
cnt
INT
;
WHILE
x
>
0
DO
SET
rnd
=
x
%
100
;
SET
cnt
=
(
SELECT
COUNT
(
*
)
FROM
t1
WHERE
a
=
rnd
);
INSERT
INTO
t1
(
a
,
b
)
VALUES
(
rnd
,
CAST
(
cnt
AS
CHAR
));
SET
x
=
x
-
1
;
END
WHILE
;
END
|
DELIMITER
;
|
CALL
a
(
1000
);
SELECT
a
FROM
t1
WHERE
a
=
0
;
SELECT
DISTINCT
a
FROM
t1
WHERE
a
=
0
;
SELECT
COUNT
(
DISTINCT
a
)
FROM
t1
WHERE
a
=
0
;
DROP
TABLE
t1
;
DROP
PROCEDURE
a
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment