Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
lesson plan
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Bugzilla
Bugzilla
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
王雷
lesson plan
Commits
3022f178
Commit
3022f178
authored
Jan 24, 2019
by
王雷
😹
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
统一用词 (┬_┬)
parent
913aadec
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
(SQL)优化分析与方法.md
(SQL)优化分析与方法.md
+10
-10
No files found.
(SQL)优化分析与方法.md
View file @
3022f178
...
@@ -197,16 +197,16 @@ limit 15
...
@@ -197,16 +197,16 @@ limit 15
  
我们反过来看 SQL,可以看到其中的子查询是
  
我们反过来看 SQL,可以看到其中的子查询是
```
sql
```
sql
SELECT
b
.
num
,
sbxx
.
SB_ID
,
sbxx
.
BB_DM
select
b
.
num
,
sbxx
.
sb_id
,
sbxx
.
bb_dm
FROM
agency_tax
.
sb_sbxx_bbmx
sbxx
from
agency_tax
.
sb_sbxx_bbmx
sbxx
LEFT
JOIN
(
left
join
(
SELECT
COUNT
(
*
)
num
,
bbmx
.
SB_ID
sbI
d
select
count
(
*
)
num
,
bbmx
.
sb_id
sbi
d
FROM
agency_tax
.
sb_sbxx_bbmx
bbmx
from
agency_tax
.
sb_sbxx_bbmx
bbmx
WHERE
bbmx
.
STATE
=
'Y
'
where
bbmx
.
state
=
'y
'
GROUP
BY
bbmx
.
SB_ID
group
by
bbmx
.
sb_id
)
b
ON
b
.
sbId
=
sbxx
.
SB_ID
)
b
on
b
.
sbid
=
sbxx
.
sb_id
WHERE
sbxx
.
STATE
=
'Y'
where
sbxx
.
state
=
'Y'
GROUP
BY
sbxx
.
ID
group
by
sbxx
.
id
```
```
  
进一步分析发现,这个子查询竟然又嵌套了一个子查询,更令人费解的是,这个查询竟然是对同一张表,通过对 SQL 分析,这个查询的目的应该是提取符合条件的记录总数,然后对外提供查询。
  
进一步分析发现,这个子查询竟然又嵌套了一个子查询,更令人费解的是,这个查询竟然是对同一张表,通过对 SQL 分析,这个查询的目的应该是提取符合条件的记录总数,然后对外提供查询。
...
...
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