「SQL」order byで指定項目の昇順で並ぶサンプル
構文
SELECT カラム1, カラム2, xxx
FROM テーブル名
ORDER BY カラム1, カラム2, xxx ASC
使用例
SELECT ContactName,Address,City,Country FROM Customers ORDER BY Address,Country ASC;
結果
ContactName | Address | City | Country |
---|---|---|---|
Annette Roulet | 1 rue Alsace-Lorraine | Toulouse | France |
John Steel | 12 Orchestra Terrace | Walla Walla | USA |
Laurence Lebihans | 12, rue des Bouchers | Marseille | France |