Subject Re: [firebird-support] SQL problem
Author Aage Johansen
paultugwell wrote:
> I'm not sure if this is an appropriate place to post this message, but
> if not can somebody suggest a suitable support group I could use.
>
> I have a FB database with 2 tables A and B. If I run the following query
>
> SELECT A.FIELD_A1, A.FIELD_A2
> FROM A JOIN B ON A.FIELD_A1 = B.FIELD_B1 AND A.FIELD_A2 = B.FIELD_B2
> WHERE B.FIELD_B3 = 'C'
>
> I get a list of all rows in table A that have FIELD_B3 in table B set
> to 'C'. I want to run a delete query that deletes all of the rows
> returned by this select query, but I can't figure out the correct
> syntax. Can someone help please.
>


Maybe something along the lines of

delete from ATBL A
where exists (select 1
from BTBL B
where B.FIELD_B1 = A.FIELD_A1
and B.FIELD_B2 = A.FIELD_A2
and B.FIELD_B3 = 'C'
)

--
Aage J.