举例:
public class Parent{//定义父类Parent public int a=1//定义父类中的一个变量a}public class Son extend Parent{//定义子类son,继承父类parent public void show(){ int b = super.a//通过super访问父类变量a,获取值赋值给b }}
select t1.name,t2.name,t3.name,t4.namefrom tb as t1
left join tb as t2 on t2.pid=t1.id and t2.pid=1
left join tb as t3 on t3.pid=t2.id and t3.pid=2
left join tb as t4 on t4.pid=t3.id and t4.pid=3
where pid=0
加多一列层级码,会简单很多比如亚洲用‘01’ 中国用‘0101’,北京用‘010101‘,海定用‘01010101’,东城用’01010102‘这样语句可以
select id as col1,(select name from 表 where code = SubString(a.Code, 1,2)) as col2,
(select name from 表 where code = SubString(a.Code, 3,2)) as col3,
(select name from 表 where code = SubString(a.Code, 5,2)) as col4,
(select name from 表 where code = SubString(a.Code, 7,2)) as col5
from 表 a where Type = 'Distric'
不然
(select d.name from 表 b, 表 c, 表 d where a.parentid = b.id and b.parentid = c.id
and c.parentid = d.id) as col2,...
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)