akxxiv
Новичок
База MySQL. Структура:
Делаю два запроса:
и
В итоге два разных порядка сортировки:
В первом случае так ( http://joxi.ru/XAnaU4wyTJB0YxgFRMQ )
Код:
CREATE TABLE `cms_site_structure` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`parent_id` int(10) unsigned NOT NULL DEFAULT '0',
`priority` int(10) unsigned NOT NULL DEFAULT '0',
`name` varchar(40) NOT NULL DEFAULT '',
`uri` varchar(255) NOT NULL DEFAULT '',
`title` varchar(100) NOT NULL DEFAULT ''
PRIMARY KEY (`id`),
UNIQUE KEY `uri` (`uri`),
KEY `parent_id` (`parent_id`),
KEY `priority` (`priority`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
Код:
SELECT
site_structure.`uri` as `uri`,
site_structure.`title` as `title`
FROM cms_site_structure AS site_structure
WHERE
site_structure.`uri`='/' OR site_structure.`uri`='/catalogue/' OR site_structure.`uri`='/catalogue/bikes/' OR site_structure.`uri`='/catalogue/bikes/GF_Wahoo_2012/'
ORDER BY site_structure.`uri` ASC
Код:
SELECT
site_structure.`uri` as `uri`
FROM cms_site_structure AS site_structure
WHERE
site_structure.`uri`='/' OR site_structure.`uri`='/catalogue/' OR site_structure.`uri`='/catalogue/bikes/' OR site_structure.`uri`='/catalogue/bikes/GF_Wahoo_2012/'
ORDER BY site_structure.`uri` ASC
В первом случае так ( http://joxi.ru/XAnaU4wyTJB0YxgFRMQ )
- /
- /catalogue/bikes/
- /catalogue/
- /
- /catalogue/
- /catalogue/bikes/