Posted by alacrite on 09/28/05 22:03
I will apologize in advanced for spamming the group with newbie
questions. I do not have a reference in front of me and several google
attempts have come up on sucessful for the kind of information that I
am looking for. That being said here is my question/problem:
In a MSSQL database I want to create a trigger. I have 'product'
table where products can be linked together via a 'link' table to other
products. In this particular situation there can be a kind of master
product that other products are then cloned(i.e. they have the same
record values other than primary key) from (yes lot of data
redundancy!). If a clone is made from the master there is a link
between the two id's of the 'product' table made in the 'link' table.
Now the trigger must coordinate the the master products prices with
the linked products.
Here is a query that does what I want I just need it in trigger form.
update product
set price = (select price from product where prod_id = xxxyz)
where prod_id in (select related_id
from link
where id = xxxyz)
where xxxyz is the prod_id of the master product whose price is being
updated.
(I know this is not the ideal database set up but it is what I have to
work with )
- thanks!
Jake
Navigation:
[Reply to this message]
|