最新回答 / 慕雪6618084
select user_id,timestr,kills,(slelect count(*) from user_kills b where b-user_id=auser_id and a.lills <= b.killls)? ? ad cnt from use_kills a group by user_id = d.id here
2018-11-07
已采納回答 / 慕粉_藍(lán)
你是知道id=3的這條記錄滿足條件'user1中user_name和user2中user_name相同'當(dāng)你不知道具體哪條記錄滿足條件的時候就只能利用條件去查詢表2中'與表1的字段user_name相同的記錄'
2018-07-09
已采納回答 / jamieacejiang
加了where b.user_id = c.user_id這個條件,max(c.kills)是可變的(會求出3個userid的各個的最大值,然后去外面卡where條件),不加,這個值是固定的(是這些userid里最大的一個值,無意義)。
2018-07-06
最贊回答 / 惡魔督督
-- 注意自己是否需要建庫create database if not exists mysqldv1;use mysqldv1;??-- 新建 user1 表?create table if not exists user1(? id smallint unsigned primary key auto_increment,?? user_name varchar(40),?? over1 varchar(40));-- 新建 user2 表create table if not exists user...
2018-04-20
最新回答 / 0_菇?jīng)鰧⑽易魃鮛0
where b.kills = (select max(c.kills) from user_kills as c where b.user_id = c.user_id);可以這么理解:括號外的where b.user_id依次取數(shù),但是只要滿足括號內(nèi)where b.user_id = c.user_id,即把同類ID最大的kills返回,相當(dāng)于有一個分組條件;若不加上的話,只返回kills中最大的值,這個值是唯一的
2018-03-14
最贊回答 / 野生碼農(nóng)在線co腚
right join 是以右表為基礎(chǔ) 也就是B表為基礎(chǔ)的, B表不可能有空值 .? 你說的 b.over is not null 加不加一樣..? 應(yīng)該是a.username is not null 就查出了 a.b重合的部分
2018-03-12