Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dlink
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhaowei
dlink
Commits
3f2d8cd7
Unverified
Commit
3f2d8cd7
authored
Sep 06, 2022
by
byd-android-2017
Committed by
GitHub
Sep 06, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update aggtable.md (#995)
新版实现AGG BY TO_MAP(cls,score) as (data)返回的数据类型是内建MAP类型,因此可以用键值对的方式直接访问,简单高效。
parent
a2b9e503
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
8 deletions
+11
-8
aggtable.md
...sioned_docs/version-0.6/extend/practice_guide/aggtable.md
+11
-8
No files found.
docs/versioned_docs/version-0.6/extend/practice_guide/aggtable.md
View file @
3f2d8cd7
...
...
@@ -341,14 +341,17 @@ FROM score
GROUP
BY
sid
AGG
BY
TO_MAP
(
cls
,
score
)
as
(
data
);
insert
into
studentscore
select
a
.
sid
,
a
.
name
,
cast
(
GET_KEY
(
b
.
data
,
'chinese'
,
'0'
)
as
int
),
cast
(
GET_KEY
(
b
.
data
,
'math'
,
'0'
)
as
int
),
cast
(
GET_KEY
(
b
.
data
,
'english'
,
'0'
)
as
int
)
from
student
a
left
join
aggscore2
b
on
a
.
sid
=
b
.
sid
insert
into
studentscore
select
a
.
sid
,
a
.
name
,
b
.
data
[
'chinese'
]
,
b
.
data
[
'math'
],
b
.
data
[
'english'
]
from
student
a
left
join
aggscore2
b
on
a
.
sid
=
b
.
sid
;
```
本实例通过表值聚合将分组后的多行转单列然后通过 GET_KEY 取值的思路来实现。同时,也使用了 Fragment 机制。
...
...
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