-1
我有代码的表像SQL JOIN表select语句
0100 ABC
0100 ASD
9010 ABC
5555 ABC
我想创建select语句,这会带给我两列像
calumn A (all the codes starting with 0100), column B (all the codes that after the first 4 chars, have the same ending with column A)
例如
0100 ABC, 9010 ABC
0100 ABC, 5555 ABC
0100 ASD, null
我在想像
select mtr.code, mtr1.code
from material mtr
where mtr.code like (%+
select distinct substring(mtr.code,5, len(mtr.code)) code
from material mtr1
)
但它当然不起作用。有任何想法吗?
是0100单个列的值,还是0100 ABC是列的值?你可以分享一下餐桌设计吗? –
LIKE子查询不能返回超过1个值,看起来像它可能会返回更多,因为您正在使用DISTINCT – PawelCz
表材料只有一个列字符串,所以0100 ABC和其他任何东西都是该表中的单个值 – SDAGLAS