🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.sql
Article #11152

Re: Simple SQL question (I guess)

#11152
From: G. Allen Casteran
Date: Tue, 03 Dec 2002 23:32
43 lines
1939 bytes
Sergio,

The best way to do this is an AFTER INSERT trigger on the Items table. 
Do you also need an AFTER DELETE?

Allen

In article <3decf30f@newsgroups.borland.com>, shg@sion.com says...
> hello there! I'm a very begginer in SQL and have this problem.
> Just in case: I'm using IB 6.5 with Delphi 7
> Sorry if this message is too large. And sorry for my English!
> 
> I have these tables
> 1) ITEMS (id, description)
> 2) TCOST (tcost_id, description)
> 2) COST (id, tcost_id, percent) (id is FK to ITEMS and tcost_id is FK to
> TCOST)
> 
> ie:
> 
> ITEMS
> 1        SCREW
> 2        HAMMER
> 
> TCOST
> 1        TAX
> 2        SHIPPING
> 
> COST
> 1    1    nnn%
> 1    2    nnn%
> 2    1    nnn%
> 2    2    nnn%
> 
> Each time I insert a record in TCOST, I need to insert one record per each
> row being in ITEM in the table COST.
> 
> Can I do that with a simple SQL instruction? How can I do it?
> I supose that I should write a trigger in TCOST (after insert)
> 
> THanks.
> 
> Sergio.
Technical Details
Message-ID: <MPG.1856dee099f1cad4989686@forums.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-04!supernews.com!news-out.visi.com!hermes.visi.com!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3decf30f@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 114a0e,9ff790979c64f2be
X-Google-Attributes: gid114a0e,public
X-Google-ArrivalTime: 2002-12-03 15:39:32 PST
From: G. Allen Casteran <allen@nisinc.com>
Newsgroups: borland.public.interbase.sql
Subject: Re: Simple SQL question (I guess)
Date: Tue, 3 Dec 2002 15:32:17 -0800
Message-ID: <MPG.1856dee099f1cad4989686@forums.borland.com>
References: <3decf30f@newsgroups.borland.com>
Distribution: Global
Organization: Network Information Services, Inc.
X-Newsreader: MicroPlanet Gravity v2.60
NNTP-Posting-Host: 208.37.62.90
X-Trace: newsgroups.borland.com 1038958024 208.37.62.90 (3 Dec 2002 15:27:04 -0800)
Lines: 44
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-04!supernews.com!news-out.visi.com!hermes.visi.com!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail