-2
我有以下表中的條目MySQL不正確排序
+--------------------------------------------+----------+
| menu_entry | position |
+--------------------------------------------+----------+
| ADMINISTRATION::USERMANAGEMENT::USER | 2 |
| DEMO::CHART::EXAMPLE | 1 |
| PROJMGMT::PROJSTRG::LOP | 2 |
| ADMINISTRATION::USERMANAGEMENT::RIGHTSMMGT | 1 |
| PROJMGMT::PROJSTRG::MEETINGS | 1 |
| DEMO::GRID::CELLEDIT | 1 |
| DEMO::GRID::ROWEDIT | 3 |
| DEMO::DATAMGMT::GROUPING | 1 |
| DEVELOPER::APPS::ADDAPP | 2 |
| DEVELOPER::APPS::APPTEST | 1 |
| DEMO::GRID::LOCKINGDEMO | 4 |
| DEMO::GRID::FILTERDEMO | 2 |
+--------------------------------------------+----------+
我想menu_entry
第一和第二位置被訂購。我這樣做與以下聲明
select menu_entry,position from app_names order by menu_entry, position;
但它只按menu_entry排序,而不是按位置排序。 這是我發言的回報:
+--------------------------------------------+----------+
| menu_entry | position |
+--------------------------------------------+----------+
| ADMINISTRATION::USERMANAGEMENT::RIGHTSMMGT | 1 |
| ADMINISTRATION::USERMANAGEMENT::USER | 2 |
| DEMO::CHART::EXAMPLE | 1 |
| DEMO::DATAMGMT::GROUPING | 1 |
| DEMO::GRID::CELLEDIT | 1 |
| DEMO::GRID::FILTERDEMO | 2 |
| DEMO::GRID::LOCKINGDEMO | 4 |
| DEMO::GRID::ROWEDIT | 3 |
| DEVELOPER::APPS::ADDAPP | 2 |
| DEVELOPER::APPS::APPTEST | 1 |
| PROJMGMT::PROJSTRG::LOP | 2 |
| PROJMGMT::PROJSTRG::MEETINGS | 1 |
+--------------------------------------------+----------+
正如你所看到的,DEMO :: GRID :: ...未排序的權利。
你爲什麼要存儲分隔值? – 2013-04-10 13:48:02
該查詢似乎按預期工作。 – 99823 2013-04-10 13:49:09
它被排序正確。 「L」在「R」之前。所以'LOCKINGDEMO'在'ROWEDIT'之前 – 2013-04-10 13:49:21