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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
33b144f1
Commit
33b144f1
authored
Aug 19, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Manual merge
sql/sql_select.cc: Auto merged
parents
b1728c6f
6681d0bd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
3 deletions
+58
-3
mysql-test/r/distinct.result
mysql-test/r/distinct.result
+40
-0
mysql-test/t/distinct.test
mysql-test/t/distinct.test
+17
-0
sql/sql_select.cc
sql/sql_select.cc
+1
-3
No files found.
mysql-test/r/distinct.result
View file @
33b144f1
...
...
@@ -472,3 +472,43 @@ id IFNULL(dsc, '-')
2 line number two
3 line number three
drop table t1;
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
SELECT DISTINCT a, 1 FROM t1;
a 1
1 1
2 1
3 1
4 1
5 1
SELECT DISTINCT 1, a FROM t1;
1 a
1 1
1 2
1 3
1 4
1 5
CREATE TABLE t2 (a int, b int);
INSERT INTO t2 VALUES (1,1),(2,2),(2,3),(2,4),(3,5);
SELECT DISTINCT a, b, 2 FROM t2;
a b 2
1 1 2
2 2 2
2 3 2
2 4 2
3 5 2
SELECT DISTINCT 2, a, b FROM t2;
2 a b
2 1 1
2 2 2
2 2 3
2 2 4
2 3 5
SELECT DISTINCT a, 2, b FROM t2;
a 2 b
1 2 1
2 2 2
2 2 3
2 2 4
3 2 5
DROP TABLE t1,t2;
mysql-test/t/distinct.test
View file @
33b144f1
...
...
@@ -341,4 +341,21 @@ insert into t1 values (1, "line number one"), (2, "line number two"), (3, "line
select
distinct
id
,
IFNULL
(
dsc
,
'-'
)
from
t1
;
drop
table
t1
;
#
# Test cases for #12625: DISTINCT for a list with constants
#
CREATE
TABLE
t1
(
a
int
);
INSERT
INTO
t1
VALUES
(
1
),(
2
),(
3
),(
4
),(
5
);
SELECT
DISTINCT
a
,
1
FROM
t1
;
SELECT
DISTINCT
1
,
a
FROM
t1
;
CREATE
TABLE
t2
(
a
int
,
b
int
);
INSERT
INTO
t2
VALUES
(
1
,
1
),(
2
,
2
),(
2
,
3
),(
2
,
4
),(
3
,
5
);
SELECT
DISTINCT
a
,
b
,
2
FROM
t2
;
SELECT
DISTINCT
2
,
a
,
b
FROM
t2
;
SELECT
DISTINCT
a
,
2
,
b
FROM
t2
;
DROP
TABLE
t1
,
t2
;
# End of 4.1 tests
sql/sql_select.cc
View file @
33b144f1
...
...
@@ -12229,9 +12229,7 @@ create_distinct_group(THD *thd, Item **ref_pointer_array,
li
.
rewind
();
while
((
item
=
li
++
))
{
if
(
item
->
const_item
()
||
item
->
with_sum_func
)
continue
;
if
(
!
item
->
marker
)
if
(
!
item
->
const_item
()
&&
!
item
->
with_sum_func
&&
!
item
->
marker
)
{
ORDER
*
ord
=
(
ORDER
*
)
thd
->
calloc
(
sizeof
(
ORDER
));
if
(
!
ord
)
...
...
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