我试图让所有与父级相关的子级ID(多级)。我认为使用Recursive会做到这一点,试图查询它没有返回预期的结果,我甚至不知道这是写入方式去做这件事或我会出错的地方。从结构树返回父级ID
预期结果是返回指定地点的所有城市和县。
例如,如果我传递了英格兰的id(id = 1),我想返回与它关联的所有id。它可高达4-5级关联
的例如
Id Location
----- ---------------
1 England
3 London (as its associated with England)
5 Ealing (as associated with London)
6 Westminster (as associated with London)
7 Camden (as associated with London)
8 Barnet (as associated with London)
。 。 。
可有人请点我就如何解决这个正确的方向。这是解决这个问题的正确方法吗?
谢谢。
这解决了我的问题,谢谢你的尖塔。 – 2014-10-22 14:28:38