Home » SQL & PL/SQL » SQL & PL/SQL » how do i delete the records
how do i delete the records [message #18755] Wed, 13 February 2002 07:10 Go to next message
ksr
Messages: 112
Registered: January 2002
Senior Member
I have some select statement like below...
Now what i want is to delete all the records which are fetched by this select statement,so how do i attach the delete statement to this.

(
select
C.ID as CSID
,
t1.bid as BID
,
t1.Cid as CID
from tab1 t1, Tab2 t2, Tab3 t3, tab4 t4, tab5 t5
where t5.FI_PARENT <> 0
and t5.FI_PARENT = t3.ID
and t5.FI_CHILD = t4.ID .......something like this more and conditions
group by t1......... some columns,
order by some columns.....)
Re: how do i delete the records [message #18757 is a reply to message #18755] Wed, 13 February 2002 07:27 Go to previous messageGo to next message
pratap kumar tripathy
Messages: 660
Registered: January 2002
Senior Member
Your query involves 5 tables like tab1 t1, Tab2 t2, Tab3 t3, tab4 t4, tab5 t5 .you want to delete data but from which table ?
Re: how do i delete the records [message #18760 is a reply to message #18755] Wed, 13 February 2002 08:03 Go to previous messageGo to next message
ksr
Messages: 112
Registered: January 2002
Senior Member
Hi,
in the query,finally after the select statement is executed,all the records are inserted into tab1.
So i want to delete from tab1 satisfying the select statement conditions...
Re: how do i delete the records [message #18782 is a reply to message #18755] Thu, 14 February 2002 00:16 Go to previous message
pratap kumar tripathy
Messages: 660
Registered: January 2002
Senior Member
Hi,

try

delete from tab1
where
(col1,col2,col3) in
(
select col1,col2,col3 from tab1 t1,tab2 t2,tab3 t3
where.....lot of join conditions and group by...)

cheers
pratap
Previous Topic: how to read the data from type created as table
Next Topic: Re: Explain plan
Goto Forum:
  


Current Time: Thu Apr 25 17:13:05 CDT 2024