Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4a539ff

Browse files
join优化
1 parent 11c7c20 commit 4a539ff

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

‎mysql开发技巧一/join优化

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,12 @@ select a.user_name , a.over , b.over from user1 a left join user2 b on a.user_na
8686

8787

8888

89-
89+
********************************************************************************
90+
使用join + having优化聚合子查询:
91+
select a.user_name,b.timestr,b.kills from user1 a join user_kills b on a.id = b.user_id
92+
join user_kills c on c.user_id = b.user_id
93+
group by a.user_name,btimestr,b.kills
94+
having b.kills = max(c.kills);
9095

9196

9297

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /