1
asxalex 2015 年 9 月 20 日 select tmp.username, count (1 ) cnt from (select username, count (1 ) from table_name group by username, hwid ) tmp group by tmp.username order by cnt desc;
|
2
ttcool 2015 年 9 月 20 日 select tab.username,count (tab.hwid ) from (select username,hwid from test group by hwid ) tab group by tab.username;
|
3
cxbig 2015 年 9 月 20 日 没有楼上没那么复杂吧
SELECT username, count (hwid ) FROM table GROUP BY username |
4
SilentDepth 2015 年 9 月 20 日 @cxbig 同感。再加个 ORDER BY 就更好了
|
5
coosir 2015 年 9 月 20 日 @cxbig @SilentDepth 额,这样子同终端的多次登录都会 count 进去呀
|
6
F281M6Dh8DXpD1g2 2015 年 9 月 20 日
伸手党可耻
|
7
echo1937 2015 年 9 月 20 日 MySQL 的写法. |
8
soulgeek 2015 年 9 月 20 日 3 楼的 count 加个 distinct 就好了
|
9
cxbig 2015 年 9 月 20 日 了解了,用 time 来做 count
SELECT DISTINCT username, hwid, count ($time ) FROM table GROUP BY username, hwid |
10
SilentDepth 2015 年 9 月 20 日 |
11
cxbig 2015 年 9 月 20 日 @SilentDepth 楼上正解,我记错了
|
12
SilentDepth 2015 年 9 月 20 日 @cxbig 左括号前加空格可以理解,为什么右括号前也要加……什么时候回复可以支持代码展示啊 :sigh:
|
13
cxbig 2015 年 9 月 20 日
@SilentDepth 自动给的,我没有办法。 T-T
|