Thread: Is it possible to have a cascade upwards query?

Is it possible to have a cascade upwards query?

From
Mike Martin
Date:
As per title, is this possible?

Scenario being two tables with a linking pair of fields, where one table is a superset of the other and key is generated by the second table

I would like to have the record in table two deleted when I delete the record in table 1

Thanks

Re: Is it possible to have a cascade upwards query?

From
Adrian Klaver
Date:
On 3/27/19 8:58 AM, Mike Martin wrote:
> As per title, is this possible?
> 
> Scenario being two tables with a linking pair of fields, where one table 
> is a superset of the other and key is generated by the second table
> 
> I would like to have the record in table two deleted when I delete the 
> record in table 1

Sorry not enough coffee in me yet to figure the above out:)

Could you provide a simple diagram(schema) to illustrate?

> 
> Thanks
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com



Re: Is it possible to have a cascade upwards query?

From
Joseph Testa
Date:
Is this like a cascade delete based on constraints(like in the oracle world), delete parent and all children go away also?

joe


On Wed, Mar 27, 2019 at 12:15 PM Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 3/27/19 8:58 AM, Mike Martin wrote:
> As per title, is this possible?
>
> Scenario being two tables with a linking pair of fields, where one table
> is a superset of the other and key is generated by the second table
>
> I would like to have the record in table two deleted when I delete the
> record in table 1

Sorry not enough coffee in me yet to figure the above out:)

Could you provide a simple diagram(schema) to illustrate?

>
> Thanks
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: Is it possible to have a cascade upwards query?

From
"David G. Johnston"
Date:
On Wed, Mar 27, 2019 at 8:58 AM Mike Martin <redtux1@gmail.com> wrote:
Scenario being two tables with a linking pair of fields, where one table is a superset of the other and key is generated by the second table

I would like to have the record in table two deleted when I delete the record in table 1

Since table 1 is a superset of table 2 there is no foreign key possible on which the system provided ON DELETE CASCADE could be specified.  You will need to create your own trigger to perform the deletion on table 2.

David J.