> The not-in subselect could be expensive, depending on table size. If
> it turns out to be expensive, you might consider reference counting.
Thank you for the hint. It's done on an integer column with an index, so
hopefully won't be too bad. Further tests will show though of course.
Dennis
5:17 PM
Subject: Re: [sqlite] One more SQL statement question
>> sqlite> create trigger UpdateData after update on tablea begin
>>...> delete from tableb where id=old.refb and id not in ( select
>> refb from tablea );
>
> Yep, that&
> sqlite> create trigger UpdateData after update on tablea begin
>...> delete from tableb where id=old.refb and id not in ( select
> refb from tablea );
Yep, that's exactly what I need.
Thank you!
Dennis
___
sqlite-users mailing list
sqlite-use
2009/9/10 Dennis Volodomanov :
> Hello,
>
> I have one more SQL query question - the people on this list have been very
> helpful in the past, so thank you!
>
> I'm trying to create a trigger that would delete unreferenced rows from a
> table.
>
> Let's say the schema is like this:
>
> TABLEA ( I
> This statement makes no sense to me. Why not simply
>
> delete from TABLEB where ID=old.REFB and ID != new.REFB;
But entries in TABLEB may be used by other entries in TABLEA and I don't want
them deleted if they're used by at least one entry in TABLEA.
Thanks,
Dennis
Dennis Volodomanov
wrote:
> I'm trying to create a trigger that would delete unreferenced rows
> from a table.
>
> Let's say the schema is like this:
>
> TABLEA ( ID INTEGER PRIMARY KEY, REFB INTEGER );
> TABLEB ( ID INTEGER PRIMARY KEY, DATA );
>
> And let's say the data is like this:
>
> TABLEA:
Hello,
I have one more SQL query question - the people on this list have been very
helpful in the past, so thank you!
I'm trying to create a trigger that would delete unreferenced rows from a table.
Let's say the schema is like this:
TABLEA ( ID INTEGER PRIMARY KEY, REFB INTEGER );
TABLEB ( ID
7 matches
Mail list logo