A brute force method would be to store the rowid of the owner row in each of the detail rows.

chetana bhargav wrote:
Is this a garbage collection situation, where you want a row in B to go away when all referring rows in A are deleted?


Yes exactly this is what I wanted :)

Sorry for the confusing message earlier

-x-
Chetana



----- Original Message ----
From: Trevor Talbot <[EMAIL PROTECTED]>
To: sqlite-users@sqlite.org
Sent: Monday, October 8, 2007 9:10:22 PM
Subject: Re: [sqlite] many-one relation


On 10/8/07, chetana bhargav <[EMAIL PROTECTED]> wrote:


We got two tables, tableA & tableB.

tableB is turning out to be a many-one relation where in we have many rows of 
tableA mapping to one row of tableB, would like to know what is the best way to 
delete a row in tableB

1. Keep a reference count of the number of rows that are referring to this ( to 
be honest I dont think this is good)
2. More on similar lines instead of count have row-ids and attach a trigger


I'm not clear on the scenario here.  Is this a like a foreign key
relationship, so you want a delete of a row in table B to delete all
referring rows from A?   Something else?

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------


      
____________________________________________________________________________________
Tonight's top picks. What will you watch tonight? Preview the hottest shows on 
Yahoo! TV.
http://tv.yahoo.com/


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to