Infinite class Classification 、、、 but efficiency is not the best ... Do you have code for faster and better efficiency?
When you use recursion to wait for more categories, it can affect efficiency!
Please share!
Class.sql
----
The structure ' class ' of the table-
-
set names UTF8;
CREATE TABLE ' class ' (
' id ' int ' not NULL auto_increment,
' name ' varchar () character Set UTF8 default null,< c7/> ' classid ' int () default null,
' sort ' int () not NULL default ' 0 ',
PRIMARY KEY (' id ')
engine= InnoDB DEFAULT Charset=utf8 auto_increment=11;
----
export the data in the table ' class '-
-
INSERT into ' class ' (' id ', ' name ', ' classid ', ' sort ') VALUES
(1, ' China ', 0, 1),
(2, ' Guangxi ', 1, 1),
(3, ' Guilin ', 2, 2),
(4, ' Guangdong ', 1, 2),
(5, ' Beijing ', 1, 3),
(6, ' Dongguan ', 4, Ten),
(7, ' Nanning ', 2, Ten),
(8, ' Yangshuo ', 3,
(9, ' Liuzhou ', 2, Ten),
(10, ' Guangzhou ', 4, 10);
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/webkf/PHP/