if ("sqlserver"){
sql1 = "WITH allsub(id,name )\n" +
" as (\n" +
" SELECT id,name FROM tablename where id="+_subId+" \n" +
" UNION ALL SELECT a.id,a.name FROM tablename a,allsub b where a.id = b.supFccId \n" +
" ) select * from allsub tb";
}else if("oracle"){
sql1 = "select id,name \n" +
" from tablename \n" +
" start with id="+_subId+" \n" +
" connect by prior supFccId = id";
}else if("mysql"){
sql1 = "select DISTINCT tl.lv, t.id,t.name,t.code,t.supFccId,t.type,t.Archive from (\n" +
" select @id idlist, @lv:=@lv+1 lv,\n" +
" (select @id:=group_concat(supFccId separator ',') from tablename where find_in_set(id,@id)) sub\n" +
" from tablename,(select @id:="+_subId+",@lv:=0) vars\n" +
" where @id is not null) tl,tablename t \n" +
" where find_in_set(t.id,tl.idlist) \n" +
" order by tl.lv asc";
}
sql1 = "WITH allsub(id,name )\n" +
" as (\n" +
" SELECT id,name FROM tablename where id="+_subId+" \n" +
" UNION ALL SELECT a.id,a.name FROM tablename a,allsub b where a.id = b.supFccId \n" +
" ) select * from allsub tb";
}else if("oracle"){
sql1 = "select id,name \n" +
" from tablename \n" +
" start with id="+_subId+" \n" +
" connect by prior supFccId = id";
}else if("mysql"){
sql1 = "select DISTINCT tl.lv, t.id,t.name,t.code,t.supFccId,t.type,t.Archive from (\n" +
" select @id idlist, @lv:=@lv+1 lv,\n" +
" (select @id:=group_concat(supFccId separator ',') from tablename where find_in_set(id,@id)) sub\n" +
" from tablename,(select @id:="+_subId+",@lv:=0) vars\n" +
" where @id is not null) tl,tablename t \n" +
" where find_in_set(t.id,tl.idlist) \n" +
" order by tl.lv asc";
}