On 2/9/06, Cyrille37 <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I've got a SELECT query that I would like to transform as a DELETE query ,
> but I could not write that DELETE query ;o{
>
> Here is the case :
>
> In a search engine, I would like to erase all words that are no more
> attached to a feedback entry.
>
> table Words ( IID, Word )
> table Feedbacks_has_Words ( Feedbacks_IID, Words_ID )
> table Feedbacks( IID, .... )
>
> When a word has no more feedback attached (relation is table
> Feedbacks_has_Words) ,
> it should be deleted.
>
> To find such words, this SELECT query works fine :
>
>     select IID,Word, Feedbacks_IID
>     from Words LEFT  JOIN Feedbacks_has_Words
>     on IID = Words_IID
>     where Feedbacks_IID is null
>
> I could not figure how to right the DELETE Query ...
> Have you got a idea about it ???

How about this:

delete from Words
where IID not in ( select Words_IID from Feedbacks_has_Words )

Reply via email to