Re: Not sure how to approach this

From: Andy Hardy <junkmail_at_[127.0.0.1]>
Date: Sun, 03 Sep 2006 21:09:16 +0100
Message-ID: <44fb366d$0$2683$ed2619ec_at_ptn-nntp-reader02.plus.net>


jctown_at_nb.sympatico.ca wrote:
> I have 3 tables.
> 1) books
> 2) publishers
> 3) subjects
>
> I *think* I need to use a trigger but not sure.
> I've loaded up publishers with distinct publisher from books and
> subjects from distinct subject from books. Now I want to set
> *something* up so that if I add a new row to "books" a check will be
> made on publishers and subjects to see if something new is being added
> and then add a row if this is the case.
>
> Something like
>
> On_New_Book
> insert into publishers
> select publisher from book
> where book.publisher not in (select publisher from book)
> insert into subjects
> select subject from book
> where book.subject not in (select subject from book)
>
> I don't know how close or far away I am. I'm not even sure if a
> "trigger" is what I need here.
>

[Quoted] You want to be able to see distinct publishers and distinct subjects based on information from your books? If so, sounds like you actually want to use views instead of tables for your 'publishers' and 'subjects'. Received on Sun Sep 03 2006 - 22:09:16 CEST

Original text of this message