質問編集履歴

3

編集

2018/06/14 05:32

投稿

joeast
joeast

スコア26

test CHANGED
File without changes
test CHANGED
@@ -1,4 +1,4 @@
1
- ```mysql
1
+ ```sql
2
2
 
3
3
  select (select count(*)+1 from (select usf_sid, count(*) as ct from usfavo group by usf_sid) as t1 where t1.ct > t2.ct ) as rank from (select usf_sid, count(*) as ct from usfavo group by usf_sid) as t2 where usf_sid=1
4
4
 
@@ -38,7 +38,7 @@
38
38
 
39
39
 
40
40
 
41
- ```mysql
41
+ ```sql
42
42
 
43
43
  select count(*)+1
44
44
 

2

解決いたしました

2018/06/14 05:32

投稿

joeast
joeast

スコア26

test CHANGED
File without changes
test CHANGED
@@ -33,3 +33,25 @@
33
33
  お分かりの方がおられましたらご教示いただけないでしょうか。
34
34
 
35
35
  よろしくお願いいたします。
36
+
37
+
38
+
39
+
40
+
41
+ ```mysql
42
+
43
+ select count(*)+1
44
+
45
+ from (select usf_sid, count(*) as ct1 from usfavo group by usf_sid) t1
46
+
47
+ where ct1 > (select count(*) from usfavo where usf_sid=1)
48
+
49
+ ```
50
+
51
+
52
+
53
+ こちらのコードで解決いたしました。
54
+
55
+ ご回答いただいた皆様、ありがとうございます。
56
+
57
+ ご指摘いただいた点など参考にさせていただき、勉強してきます。

1

コードの記述について更新しました

2018/06/14 05:32

投稿

joeast
joeast

スコア26

test CHANGED
File without changes
test CHANGED
@@ -1,4 +1,8 @@
1
+ ```mysql
2
+
1
3
  select (select count(*)+1 from (select usf_sid, count(*) as ct from usfavo group by usf_sid) as t1 where t1.ct > t2.ct ) as rank from (select usf_sid, count(*) as ct from usfavo group by usf_sid) as t2 where usf_sid=1
4
+
5
+ ```
2
6
 
3
7
 
4
8