我有一个库房表,内容如下:
编号 库位编号 名称 上级库位
1 1000 A库房 NULL
2 1000-1001 A库位 1000
3 1000-1001-1002 A货位 1000-1001现在我在库存表中存入的库位编号为1000-1001-1002,我想根据这个值得到它的名称
格式为(A库房-A库位-A货位),现在是三级,有可能是一级或更多,如何写sql取出
它的名称来?
谢谢各位啦,我很急!!!
编号 库位编号 名称 上级库位
1 1000 A库房 NULL
2 1000-1001 A库位 1000
3 1000-1001-1002 A货位 1000-1001现在我在库存表中存入的库位编号为1000-1001-1002,我想根据这个值得到它的名称
格式为(A库房-A库位-A货位),现在是三级,有可能是一级或更多,如何写sql取出
它的名称来?
谢谢各位啦,我很急!!!
from (select level,(substr(sys_connect_by_path(name, '-'), 2)) newname, t.*
from t
connect by prior kfbh = parentbh
order by level desc
)
where name = 'A货位' and rownum=1