[前][次][番号順一覧][スレッド一覧]

mysql:8417

From: ML account <ML account <ml@xxxxxxxxxx>>
Date: Sat, 22 Nov 2003 17:31:43 +0900
Subject: [mysql 08417] Re: 並び替えについての SQL 文

 こんにちは。

Satoshi Iwanaga <iwanaga@xxxxxxxxxx>さんの
<20031122150631Tsg5gT@xxxxxxxxxx>
"[mysql 08416] 並び替えについての SQL文"


 どんなDBMSにでも使える訳では無いですが。

mysql> desc test00;
+---------+--------------+------+-----+---------+-------+
| Field   | Type         | Null | Key | Default | Extra |
+---------+--------------+------+-----+---------+-------+
| section | int(11)      | YES  |     | NULL    |       |
| height  | int(11)      | YES  |     | NULL    |       |
| name    | varchar(64)  | YES  |     | NULL    |       |
| mail    | varchar(255) | YES  |     | NULL    |       |
+---------+--------------+------+-----+---------+-------+
4 rows in set (0.00 sec)

mysql> select * from test00;
+---------+--------+------+-----------+
| section | height | name | mail      |
+---------+--------+------+-----------+
|       1 |    162 | A    | a@xxxxxxxxxx |
|       1 |    163 | B    | b@xxxxxxxxxx |
|       1 |    164 | C    | c@xxxxxxxxxx |
|       2 |    164 | D    | d@xxxxxxxxxx |
|       1 |    164 | E    | e@xxxxxxxxxx |
|       1 |    151 | F    | f@xxxxxxxxxx |
|       2 |    175 | G    | g@xxxxxxxxxx |
|       1 |    172 | H    | h@xxxxxxxxxx |
|       1 |    180 | I    | i@xxxxxxxxxx |
+---------+--------+------+-----------+
9 rows in set (0.00 sec)

mysql> select * from test00 where section=1 and height>=164
    -> order by not(mail='e@xxxxxxxxxx'),name;
+---------+--------+------+-----------+
| section | height | name | mail      |
+---------+--------+------+-----------+
|       1 |    164 | E    | e@xxxxxxxxxx |
|       1 |    164 | C    | c@xxxxxxxxxx |
|       1 |    172 | H    | h@xxxxxxxxxx |
|       1 |    180 | I    | i@xxxxxxxxxx |
+---------+--------+------+-----------+
4 rows in set (0.00 sec)




	松枝知直	<tomom@xxxxxxxxxx>
			http://www.argus.ne.jp/~tomom/



[前][次][番号順一覧][スレッド一覧]

      8416 2003-11-22 15:06 [Satoshi Iwanaga <iwa] 並び替えについての SQL 文               
->    8417 2003-11-22 17:31 ┣[ML account <ml@xxxxx]                                       
      8418 2003-11-22 17:45 ┃┗[Satoshi Iwanaga <iwa]                                     
      8425 2003-11-25 19:51 ┗[Satoshi Iwanaga <iwa] Re: 並び替え・表示についての SQL 文   
      8426 2003-11-25 21:30  ┗["Kawaji, Shinya" <ka]