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
59d9b52f
Commit
59d9b52f
authored
Jan 30, 2007
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
manual merge
parent
40320e8c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
213 additions
and
0 deletions
+213
-0
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+113
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+100
-0
No files found.
mysql-test/r/subselect.result
View file @
59d9b52f
...
@@ -3611,3 +3611,116 @@ SELECT * FROM t1 WHERE _utf8'a' = ANY (SELECT s1 FROM t1);
...
@@ -3611,3 +3611,116 @@ SELECT * FROM t1 WHERE _utf8'a' = ANY (SELECT s1 FROM t1);
s1
s1
a
a
DROP TABLE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t1xt2;
CREATE TABLE t1 (
id_1 int(5) NOT NULL,
t varchar(4) DEFAULT NULL
);
CREATE TABLE t2 (
id_2 int(5) NOT NULL,
t varchar(4) DEFAULT NULL
);
CREATE TABLE t1xt2 (
id_1 int(5) NOT NULL,
id_2 int(5) NOT NULL
);
INSERT INTO t1 VALUES (1, 'a'), (2, 'b'), (3, 'c'), (4, 'd');
INSERT INTO t2 VALUES (2, 'bb'), (3, 'cc'), (4, 'dd'), (12, 'aa');
INSERT INTO t1xt2 VALUES (2, 2), (3, 3), (4, 4);
SELECT DISTINCT t1.id_1 FROM t1 WHERE
(12 IN (SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1));
id_1
SELECT DISTINCT t1.id_1 FROM t1 WHERE
(12 IN ((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1)));
id_1
SELECT DISTINCT t1.id_1 FROM t1 WHERE
(12 IN (((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1))));
id_1
SELECT DISTINCT t1.id_1 FROM t1 WHERE
(12 NOT IN (SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1));
id_1
1
2
3
4
SELECT DISTINCT t1.id_1 FROM t1 WHERE
(12 NOT IN ((SELECT t1xt2.id_2 FROM t1xt2 where t1.id_1 = t1xt2.id_1)));
id_1
1
2
3
4
SELECT DISTINCT t1.id_1 FROM t1 WHERE
(12 NOT IN (((SELECT t1xt2.id_2 FROM t1xt2 where t1.id_1 = t1xt2.id_1))));
id_1
1
2
3
4
insert INTO t1xt2 VALUES (1, 12);
SELECT DISTINCT t1.id_1 FROM t1 WHERE
(12 IN (SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1));
id_1
1
SELECT DISTINCT t1.id_1 FROM t1 WHERE
(12 IN ((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1)));
id_1
1
SELECT DISTINCT t1.id_1 FROM t1 WHERE
(12 IN (((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1))));
id_1
1
SELECT DISTINCT t1.id_1 FROM t1 WHERE
(12 NOT IN (SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1));
id_1
2
3
4
SELECT DISTINCT t1.id_1 FROM t1 WHERE
(12 NOT IN ((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1)));
id_1
2
3
4
SELECT DISTINCT t1.id_1 FROM t1 WHERE
(12 NOT IN (((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1))));
id_1
2
3
4
insert INTO t1xt2 VALUES (2, 12);
SELECT DISTINCT t1.id_1 FROM t1 WHERE
(12 IN (SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1));
id_1
1
2
SELECT DISTINCT t1.id_1 FROM t1 WHERE
(12 IN ((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1)));
id_1
1
2
SELECT DISTINCT t1.id_1 FROM t1 WHERE
(12 IN (((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1))));
id_1
1
2
SELECT DISTINCT t1.id_1 FROM t1 WHERE
(12 NOT IN (SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1));
id_1
3
4
SELECT DISTINCT t1.id_1 FROM t1 WHERE
(12 NOT IN ((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1)));
id_1
3
4
SELECT DISTINCT t1.id_1 FROM t1 WHERE
(12 NOT IN (((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1))));
id_1
3
4
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t1xt2;
mysql-test/t/subselect.test
View file @
59d9b52f
...
@@ -2516,3 +2516,103 @@ CREATE TABLE t1 (s1 char(1));
...
@@ -2516,3 +2516,103 @@ CREATE TABLE t1 (s1 char(1));
INSERT
INTO
t1
VALUES
(
'a'
);
INSERT
INTO
t1
VALUES
(
'a'
);
SELECT
*
FROM
t1
WHERE
_utf8
'a'
=
ANY
(
SELECT
s1
FROM
t1
);
SELECT
*
FROM
t1
WHERE
_utf8
'a'
=
ANY
(
SELECT
s1
FROM
t1
);
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
# Bug#21904 (parser problem when using IN with a double "(())")
#
--
disable_warnings
DROP
TABLE
IF
EXISTS
t1
;
DROP
TABLE
IF
EXISTS
t2
;
DROP
TABLE
IF
EXISTS
t1xt2
;
--
enable_warnings
CREATE
TABLE
t1
(
id_1
int
(
5
)
NOT
NULL
,
t
varchar
(
4
)
DEFAULT
NULL
);
CREATE
TABLE
t2
(
id_2
int
(
5
)
NOT
NULL
,
t
varchar
(
4
)
DEFAULT
NULL
);
CREATE
TABLE
t1xt2
(
id_1
int
(
5
)
NOT
NULL
,
id_2
int
(
5
)
NOT
NULL
);
INSERT
INTO
t1
VALUES
(
1
,
'a'
),
(
2
,
'b'
),
(
3
,
'c'
),
(
4
,
'd'
);
INSERT
INTO
t2
VALUES
(
2
,
'bb'
),
(
3
,
'cc'
),
(
4
,
'dd'
),
(
12
,
'aa'
);
INSERT
INTO
t1xt2
VALUES
(
2
,
2
),
(
3
,
3
),
(
4
,
4
);
# subselect returns 0 rows
SELECT
DISTINCT
t1
.
id_1
FROM
t1
WHERE
(
12
IN
(
SELECT
t1xt2
.
id_2
FROM
t1xt2
WHERE
t1
.
id_1
=
t1xt2
.
id_1
));
SELECT
DISTINCT
t1
.
id_1
FROM
t1
WHERE
(
12
IN
((
SELECT
t1xt2
.
id_2
FROM
t1xt2
WHERE
t1
.
id_1
=
t1xt2
.
id_1
)));
SELECT
DISTINCT
t1
.
id_1
FROM
t1
WHERE
(
12
IN
(((
SELECT
t1xt2
.
id_2
FROM
t1xt2
WHERE
t1
.
id_1
=
t1xt2
.
id_1
))));
SELECT
DISTINCT
t1
.
id_1
FROM
t1
WHERE
(
12
NOT
IN
(
SELECT
t1xt2
.
id_2
FROM
t1xt2
WHERE
t1
.
id_1
=
t1xt2
.
id_1
));
SELECT
DISTINCT
t1
.
id_1
FROM
t1
WHERE
(
12
NOT
IN
((
SELECT
t1xt2
.
id_2
FROM
t1xt2
where
t1
.
id_1
=
t1xt2
.
id_1
)));
SELECT
DISTINCT
t1
.
id_1
FROM
t1
WHERE
(
12
NOT
IN
(((
SELECT
t1xt2
.
id_2
FROM
t1xt2
where
t1
.
id_1
=
t1xt2
.
id_1
))));
insert
INTO
t1xt2
VALUES
(
1
,
12
);
# subselect returns 1 row
SELECT
DISTINCT
t1
.
id_1
FROM
t1
WHERE
(
12
IN
(
SELECT
t1xt2
.
id_2
FROM
t1xt2
WHERE
t1
.
id_1
=
t1xt2
.
id_1
));
SELECT
DISTINCT
t1
.
id_1
FROM
t1
WHERE
(
12
IN
((
SELECT
t1xt2
.
id_2
FROM
t1xt2
WHERE
t1
.
id_1
=
t1xt2
.
id_1
)));
SELECT
DISTINCT
t1
.
id_1
FROM
t1
WHERE
(
12
IN
(((
SELECT
t1xt2
.
id_2
FROM
t1xt2
WHERE
t1
.
id_1
=
t1xt2
.
id_1
))));
SELECT
DISTINCT
t1
.
id_1
FROM
t1
WHERE
(
12
NOT
IN
(
SELECT
t1xt2
.
id_2
FROM
t1xt2
WHERE
t1
.
id_1
=
t1xt2
.
id_1
));
SELECT
DISTINCT
t1
.
id_1
FROM
t1
WHERE
(
12
NOT
IN
((
SELECT
t1xt2
.
id_2
FROM
t1xt2
WHERE
t1
.
id_1
=
t1xt2
.
id_1
)));
SELECT
DISTINCT
t1
.
id_1
FROM
t1
WHERE
(
12
NOT
IN
(((
SELECT
t1xt2
.
id_2
FROM
t1xt2
WHERE
t1
.
id_1
=
t1xt2
.
id_1
))));
insert
INTO
t1xt2
VALUES
(
2
,
12
);
# subselect returns more than 1 row
SELECT
DISTINCT
t1
.
id_1
FROM
t1
WHERE
(
12
IN
(
SELECT
t1xt2
.
id_2
FROM
t1xt2
WHERE
t1
.
id_1
=
t1xt2
.
id_1
));
SELECT
DISTINCT
t1
.
id_1
FROM
t1
WHERE
(
12
IN
((
SELECT
t1xt2
.
id_2
FROM
t1xt2
WHERE
t1
.
id_1
=
t1xt2
.
id_1
)));
SELECT
DISTINCT
t1
.
id_1
FROM
t1
WHERE
(
12
IN
(((
SELECT
t1xt2
.
id_2
FROM
t1xt2
WHERE
t1
.
id_1
=
t1xt2
.
id_1
))));
SELECT
DISTINCT
t1
.
id_1
FROM
t1
WHERE
(
12
NOT
IN
(
SELECT
t1xt2
.
id_2
FROM
t1xt2
WHERE
t1
.
id_1
=
t1xt2
.
id_1
));
SELECT
DISTINCT
t1
.
id_1
FROM
t1
WHERE
(
12
NOT
IN
((
SELECT
t1xt2
.
id_2
FROM
t1xt2
WHERE
t1
.
id_1
=
t1xt2
.
id_1
)));
SELECT
DISTINCT
t1
.
id_1
FROM
t1
WHERE
(
12
NOT
IN
(((
SELECT
t1xt2
.
id_2
FROM
t1xt2
WHERE
t1
.
id_1
=
t1xt2
.
id_1
))));
DROP
TABLE
t1
;
DROP
TABLE
t2
;
DROP
TABLE
t1xt2
;
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