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
75695352
Commit
75695352
authored
Dec 10, 2001
by
monty@hundin.mysql.fi
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
db2e22bf
12058c29
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
12 deletions
+34
-12
Docs/manual.texi
Docs/manual.texi
+2
-0
mysql-test/t/group_by.test
mysql-test/t/group_by.test
+24
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+8
-11
No files found.
Docs/manual.texi
View file @
75695352
...
...
@@ -46420,6 +46420,8 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.47
@itemize @bullet
@item
Fixed that @code{GROUP BY expr DESC} works.
@item
Fixed bug when using @code{t1 LEFT JOIN t2 ON t2.key=constant}.
@item
@code{mysqlconfig} now also work with binary (relocated) distributions.
mysql-test/t/group_by.test
View file @
75695352
...
...
@@ -38,7 +38,6 @@ INSERT INTO t2 VALUES (3,'name','pass','mail','Y','v','n','adr','1','1','1');
SELECT
t2
.
userid
,
MIN
(
t1
.
score
)
FROM
t1
,
t2
WHERE
t1
.
userID
=
t2
.
userID
GROUP
BY
t2
.
userid
;
SELECT
t2
.
userid
,
MIN
(
t1
.
score
)
FROM
t1
,
t2
WHERE
t1
.
userID
=
t2
.
userID
AND
t1
.
spID
=
2
GROUP
BY
t2
.
userid
;
SELECT
t2
.
userid
,
MIN
(
t1
.
score
+
0.0
)
FROM
t1
,
t2
WHERE
t1
.
userID
=
t2
.
userID
AND
t1
.
spID
=
2
GROUP
BY
t2
.
userid
;
drop
table
test
.
t1
,
test
.
t2
;
#
...
...
@@ -220,3 +219,27 @@ select 1+1, "a",count(*) from t1 where foo in (2);
insert
into
t1
values
(
1
);
select
1
+
1
,
"a"
,
count
(
*
)
from
t1
where
foo
in
(
2
);
drop
table
t1
;
#
# Test GROUP BY DESC
CREATE
TABLE
t1
(
spID
int
(
10
)
unsigned
,
userID
int
(
10
)
unsigned
,
score
smallint
(
5
)
unsigned
,
key
(
spid
),
key
(
score
)
);
INSERT
INTO
t1
VALUES
(
1
,
1
,
1
),(
2
,
2
,
2
),(
2
,
1
,
1
),(
3
,
3
,
3
),(
4
,
3
,
3
),(
5
,
3
,
3
);
explain
select
userid
,
count
(
*
)
from
t1
group
by
userid
desc
;
select
userid
,
count
(
*
)
from
t1
group
by
userid
desc
;
explain
select
spid
,
count
(
*
)
from
t1
where
spid
between
1
and
2
group
by
spid
desc
;
explain
select
spid
,
count
(
*
)
from
t1
where
spid
between
1
and
2
group
by
spid
;
select
spid
,
count
(
*
)
from
t1
where
spid
between
1
and
2
group
by
spid
;
select
spid
,
count
(
*
)
from
t1
where
spid
between
1
and
2
group
by
spid
desc
;
explain
select
sql_big_result
spid
,
sum
(
userid
)
from
t1
group
by
spid
desc
;
select
sql_big_result
spid
,
sum
(
userid
)
from
t1
group
by
spid
desc
;
explain
select
sql_big_result
score
,
count
(
*
)
from
t1
group
by
score
desc
;
select
sql_big_result
score
,
count
(
*
)
from
t1
group
by
score
desc
;
drop
table
t1
;
sql/sql_yacc.yy
View file @
75695352
...
...
@@ -509,7 +509,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
ulonglong_num
%type <item>
literal text_literal insert_ident
group_ident
order_ident
literal text_literal insert_ident order_ident
simple_ident select_item2 expr opt_expr opt_else sum_expr in_sum_expr
table_wild opt_pad no_in_expr expr_expr simple_expr no_and_expr
using_list
...
...
@@ -2071,10 +2071,10 @@ group_clause:
| GROUP BY group_list
group_list:
group_list ','
group_ident
{ if (add_group_to_list($3,(bool)
1
)) YYABORT; }
|
group_ident
{ if (add_group_to_list($1,(bool)
1
)) YYABORT; }
group_list ','
order_ident order_dir
{ if (add_group_to_list($3,(bool)
$4
)) YYABORT; }
|
order_ident order_dir
{ if (add_group_to_list($1,(bool)
$2
)) YYABORT; }
/*
** Order by statement in select
...
...
@@ -2085,7 +2085,7 @@ opt_order_clause:
| order_clause
order_clause:
ORDER_SYM BY
{ Select->sort_default=1; }
order_list
ORDER_SYM BY order_list
order_list:
order_list ',' order_ident order_dir
...
...
@@ -2095,8 +2095,8 @@ order_list:
order_dir:
/* empty */ { $$ = 1; }
| ASC { $$ =
Select->sort_default=
1; }
| DESC { $$ =
Select->sort_default=
0; }
| ASC { $$ =1; }
| DESC { $$ =0; }
limit_clause:
...
...
@@ -2815,9 +2815,6 @@ table_wild:
| ident '.' ident '.' '*'
{ $$ = new Item_field((current_thd->client_capabilities & CLIENT_NO_SCHEMA ? NullS : $1.str),$3.str,"*"); }
group_ident:
order_ident order_dir
order_ident:
expr { $$=$1; }
...
...
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