Subject | Re: [firebird-support] delete from table... best way? |
---|---|
Author | Daniel L. Miller |
Post date | 2011-09-15T15:54:09Z |
On 9/15/2011 6:24 AM, Sergio H. Gonzalez wrote:
foreign key with cascading deletes, then you can never have a t2.id null
and any delete of t1 will cascade and automatically delete the
associated records in t2.
--
Daniel
> [FB 2.5]Not sure what your use is - but if you have t1.id_t2 defined as a
>
> Hello there!
>
> a have a very common situation... a table (T1) which is joined to T2...
> I want to delete all records from T1 that has a null description in T2
>
> this works fine:
>
> delete from t1 where (select t2.descripcion from t2 where (t1.id_t2 =
> t2.id)) is null
>
> but I wander if there is a better (shorter?) way to do the same...
>
foreign key with cascading deletes, then you can never have a t2.id null
and any delete of t1 will cascade and automatically delete the
associated records in t2.
--
Daniel