Update table Error : single-row subquery returns more than one row
Update table Error : single-row subquery returns more than one row
(OP)
Hi,
im newbie of sql user
Im try to write a script to update description base on condition that u insert
, the purpose of write this query is for "Remove Title" by using substring ,
Eg: "TT MOVIE dynasty package" , change description to display "dynasty package"
but its pop--up common error "single-row subquery returns more than one row".
here is my query
update table1
--Is set for remove the front title description
set descr = (select SUBSTR(t1.descr,10)
from table1 t1,
table2 t2,
table3 t3,
table4 t4,
table5 t5
where
t1.id=table1.id and
t1.t2_OBJ_ID0 = t2.id and
t3.id = t2.t3_OBJ_ID0 and
t3.id = t4.t3_OBJ_ID0 and
t5.id = t4.t5_OBJ_ID0 and
----retrieve which title description
upper(t1.descr) like 'TT MOVIE%'
---- to insert the condition that you want to remove
t5.descr in(
'TT MOVIE dynasty package',
'TT MOVIE western package'
)
)
where exists (select SUBSTR(t1.descr,10)
from table1 t1,
table2 t2,
table3 t3,
table4 t4,
table5 t5
where
t1.id=table1.id and
t1.t2_OBJ_ID0 = t2.id and
t3.id = t2.t3_OBJ_ID0 and
t3.id = t4.t3_OBJ_ID0 and
t5.id = t4.t5_OBJ_ID0 and
--retrieve which title description
upper(t1.descr) like 'TT MOVIE%'
-- to insert the condition that you want to remove
t5.descr in(
'TT MOVIE dynasty package',
'TT MOVIE western package'
)
);
thanks
regards,
s1
im newbie of sql user
Im try to write a script to update description base on condition that u insert
, the purpose of write this query is for "Remove Title" by using substring ,
Eg: "TT MOVIE dynasty package" , change description to display "dynasty package"
but its pop--up common error "single-row subquery returns more than one row".
here is my query
update table1
--Is set for remove the front title description
set descr = (select SUBSTR(t1.descr,10)
from table1 t1,
table2 t2,
table3 t3,
table4 t4,
table5 t5
where
t1.id=table1.id and
t1.t2_OBJ_ID0 = t2.id and
t3.id = t2.t3_OBJ_ID0 and
t3.id = t4.t3_OBJ_ID0 and
t5.id = t4.t5_OBJ_ID0 and
----retrieve which title description
upper(t1.descr) like 'TT MOVIE%'
---- to insert the condition that you want to remove
t5.descr in(
'TT MOVIE dynasty package',
'TT MOVIE western package'
)
)
where exists (select SUBSTR(t1.descr,10)
from table1 t1,
table2 t2,
table3 t3,
table4 t4,
table5 t5
where
t1.id=table1.id and
t1.t2_OBJ_ID0 = t2.id and
t3.id = t2.t3_OBJ_ID0 and
t3.id = t4.t3_OBJ_ID0 and
t5.id = t4.t5_OBJ_ID0 and
--retrieve which title description
upper(t1.descr) like 'TT MOVIE%'
-- to insert the condition that you want to remove
t5.descr in(
'TT MOVIE dynasty package',
'TT MOVIE western package'
)
);
thanks
regards,
s1
RE: Update table Error : single-row subquery returns more than one row
UPDATE table1
SET descr = SUBSTR(descr,10)
WHERE upper(descr) LIKE 'TT MOVIE%'
Hope This Helps, PH.
FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions?
FAQ181-2886: How can I maximize my chances of getting an answer?
RE: Update table Error : single-row subquery returns more than one row
its not only use 1 table to update.... it may join more than 4 table...
but my problem is solved .....
any thanks for ur solution
regards,
s1
RE: Update table Error : single-row subquery returns more than one row
Could you, please, share your solution for the benefit of the members ?