oracel (列,列) in (值1,值2)的用法由于有一个excle数据拼接成一个sql语句如SQL codeselects_landedcost,s
oracel (列,列) in (值1,值2)的用法
由于有一个excle数据拼接成一个sql语句
如
SQL codeselect s_landedcost,s_styleno,s_seasonyear,s_seasoncode from t_style where (s_styleno,s_seasonyear,s_seasoncode) in ('NH199','2005','N','NH199','2005','N' );
不知道可以否?
[解决办法]不能这么用.假设
'NH199','2005','N'
'NH199','2005','N'
是某个表t的三个列,c1 , c2 , c3
select m.s_landedcost,m.s_styleno,m.s_seasonyear,m.s_seasoncode
from t_style m
where exists (select 1 from t where m.s_styleno = t.c1 and m.s_seasonyear = t.c2 and m.s_seasoncode = t.c3)
select m.s_landedcost,m.s_styleno,m.s_seasonyear,m.s_seasoncode
from t_style m,t
where m.s_styleno = t.c1 and m.s_seasonyear = t.c2 and m.s_seasoncode = t.c3
[解决办法]select s_landedcost,s_styleno,s_seasonyear,s_seasoncode
from t_style
where (s_styleno,s_seasonyear,s_seasoncode) in
(
select 'NH199','2005','N' from dual
union all
select 'NH199','2005','N' from dual
)tb;
[解决办法]SQL code--可以这样select s_landedcost, s_styleno, s_seasonyear, s_seasoncode from t_style where (s_styleno, s_seasonyear, s_seasoncode) in (('NH199', '2005', 'N'),( 'NH199', '2005', 'N'));