teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

3

追加

2016/10/10 15:55

投稿

A.Ichi
A.Ichi

スコア4070

answer CHANGED
@@ -7,4 +7,12 @@
7
7
  ```
8
8
 
9
9
  テーブル定義
10
- create table tableA (dateA date, fromA text, toA text);
10
+ create table tableA (dateA date, fromA text, toA text);
11
+
12
+
13
+ ちょと強引ですが、作ってみました。
14
+ ```sql
15
+ create table tableAA (number int,dateA date, fromA text, toA text);
16
+
17
+ insert into tableAA SELECT dense_rank() OVER (ORDER BY dateA,toA ASC) + max, t1.* FROM tableA t1, (select max(number) max from tableAA) t2 ORDER BY fromA DESC;
18
+ ```

2

更新

2016/10/10 15:55

投稿

A.Ichi
A.Ichi

スコア4070

answer CHANGED
@@ -3,7 +3,7 @@
3
3
  ```sql
4
4
  SELECT dense_rank() OVER (ORDER BY dateA,toA ASC), *
5
5
  FROM tableA
6
- ORDER BY dateA, toA ASC
6
+ ORDER BY dateA, toA ASC, fromA DESC;
7
7
  ```
8
8
 
9
9
  テーブル定義

1

変更

2016/10/08 14:19

投稿

A.Ichi
A.Ichi

スコア4070

answer CHANGED
@@ -4,4 +4,7 @@
4
4
  SELECT dense_rank() OVER (ORDER BY dateA,toA ASC), *
5
5
  FROM tableA
6
6
  ORDER BY dateA, toA ASC
7
- ```
7
+ ```
8
+
9
+ テーブル定義
10
+ create table tableA (dateA date, fromA text, toA text);