Re: Delete and select in the same query
Yes, sorry, that's the select cmd ...
select id_comment from comments where user_id=N
union
select id_comment from comments a
join comments b on a.id_parent=b.id_comment
where b.user_id=N;
The simplest way to delete those rows is probably to run these two deletion commands ..
delete from comments where user_id=N
delete a
from comments a join comments b on a.id_parent=b.id_comment
where b.user_id=N;
> why you use union?
Union does exclusive or on statement results (union all does inclusive or). It can be simpler & more efficient to do the ORing at statement level rather than in the Where clause.
Subject
Written By
Posted
September 28, 2014 02:59AM
September 28, 2014 04:17PM
September 28, 2014 11:54PM
September 29, 2014 11:47AM
September 29, 2014 12:04PM
Re: Delete and select in the same query
September 29, 2014 12:19PM
September 29, 2014 12:22PM
September 29, 2014 11:22PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.