我有一个具有100,000个位置的mysql表,我想应用嵌套集模型以便我可以轻松地生成有序列表。出于显而易见的原因,这是手动完成的一项大任务,所以我希望考虑到我的数据结构非常好,它可以用SQL(或PHP作为后备)编写。下面是表:MySQL在大型数据列表上自动生成嵌套集模型?
Id place county country
1 Abberly Worcestershire England
2 Abberton Worcestershire England
3 Abbey Field Essex England
4 Abbey St Bathans Scottish Border Scotland
5 Abbeycwmhir Powys Wales
我的计划是将内容传送到一个表像下面这样:
id location _left _right
1 England
2 Wales
3 Scotland
4 Essex
5 Powys
6 Scottish Border
7 Worcestershire
8 Abberyly
9 Abberton
10 Abbey Field
11 Abbey St Bathans
12 Abbeycwmhir
任何帮助,不胜感激!
多数民众赞成在可能的情况下,你是否尝试过自己? – Tredged
我很难找到它。我不确定是否最好的路线是建立一个只有id,name,_left,_right的新表,因为一旦这个表被移动到一个嵌套模型中,它将使得更容易选择'Worcestershire'作为'名称“,然后找到它的所有孩子的L/R值? – James