Newbie SQL question
Date: 1996/05/22
Message-ID: <4nvr5s$s1d_at_news2.texas.net>#1/1
I have a table of transactions which contains records
some of which need to be removed;
client_id varchar2(11)
I have created a view V which serves
There are a number of records in T
'12345678901' 'XXXX' 100.00 50.00
The following SQL select statement will report
the records that need to be deleted:
Here is a simplified version of the table
which we can call T:
type varchar2(4)
billed number(7, 2)
paid number(7, 2)
as an identical copy of T.
which contain in the type field the value
'VOID'. For every such record there is
at least one other record with the same
client_id and billed and paid values which
are the negative of the corresponding values
in the VOID record. I need to delete both the
VOID record and at most ONE of the matching
records. I.e, consider these two records:
'12345678901' 'VOID' -100.00 -50.00
Both of these should be deleted.
select
T.client_id, T.type, T.billed, T.paid
from
T,
V
where (
T.client_id = V.client_id
and
T.billed = - V.billed
and
T.paid = - V.paid
)
What SQL will delete the same records
that this select statement finds?
Received on Wed May 22 1996 - 00:00:00 CEST