在java代码中拼接sql语句,用的是in为什么还是报错 single-row subquery...
发布网友
发布时间:2024-04-19 21:37
我来回答
共2个回答
热心网友
时间:2024-04-20 00:20
我觉得错误在于你多写了括号的原因的
and a.assetid in(select mp.parentassetid from t_medianews_program mp,t_program_segment ps,t_segment ts where mp.subassetid = ps.parentassetid and ps.subassetid = ts.assetid and ts.name like '%111%',select cp.parentassetid from t_mediasinglecolumn_program cp,t_program_segment ps,t_segment ts where cp.subassetid = ps.parentassetid and ps.subassetid = ts.assetid
and ts.name like '%111%')
热心网友
时间:2024-04-20 00:19
oracle 的数据库还是建议你写成下面的样子!你目前写的那样,子查询里有多条记录肯定会报错.
and (exists ( select 1 from t_medianews_program mp,t_program_segment ps,t_segment ts where mp.subassetid = ps.parentassetid and ps.subassetid = ts.assetid and ts.name like '%111%' and a.assetid= mp.parentassetid )
or exists (select 2 from t_mediasinglecolumn_program cp,t_program_segment ps,t_segment ts where cp.subassetid = ps.parentassetid and ps.subassetid = ts.assetid
and ts.name like '%111%' and a.assetid= cp.parentassetid) )